.mファイル(testin1.m)を配列に読み込んで、特定の単語('auto')を検索するための短いコードを書き込もうとしています。一致するものが見つかった場合は削除します。私は次のコードを持っています、私の間違いを理解するのを手伝ってください。
fid = fopen('testin1.m');
txt = textscan(fid,'%s');
fclose(fid);
m_file_idx = 1;
data=['auto'];
B=cellstr(data);
for idx = i : length(txt)
A=txt{i};
is_auto=isequal(A, B);
if is_auto==0
txt{i}=[];
end
end
txt {i} = autoの場合、その行を削除する必要があります。