simulinkのMATLAB-function内で.txtファイルの読み込み・出力をする
17 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
■実現したいこと
simulink上のMATLAB-functionブロックでtxtファイルを読み込み、txtファイル内に#があった場合はそのデータはdataに格納させず
それ以外の場合dataに格納して出力させようとしています。
下記のエラーメッセージが表示されました。
下記のエラーに対してどのように対応すれば、ループを回しかつdataにデータを格納できるのでしょうか。
■MATLAB-functionコード
function y = fcn(scenario_list_path)
%% coder.scenario_list_pathextrinsicによりmatlab外部関数を宣言する
coder.extrinsic('readmatrix', 'readtable', 'readcell', 'readvars', 'cell2mat', 'fopen');
C = readcell(scenario_list_path);
length = size(C, 1);
data = cell(100);
j = 1;
for i = 1:length
if(strcmp('#', C(i, 1)) == 1)
continue;
end
j = j + 1;
data(j, 1) = C(i, 1);
end
y = data;
■エラーメッセージ
下記のエラーメッセージが表示されました。

0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu スプレッドシート finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!