从matlab中的文本文件中运行命令

时间:2017-10-12 17:02:19

标签: matlab

我开发了一个excel表,其中包含一些可执行行(在D2:D250范围内)。 问题是如何从Excel工作表中提取这些可执行行并在Matlab中运行这些行?

1 个答案:

答案 0 :(得分:1)

您可以执行以下操作(将excel文件导入MATLAB (Link)

之后
% Read excel file and store it in a cell array
% I've created this dummy cell array as an example
c = {'fprintf(''Command 1\n'')',
    'fprintf(''Command 2\n'')'};

% Now you can evaluate a string as a command
for i = 1:length(c)
    eval(c{i})
end
相关问题