フィルターのクリア

How to change code in scripts using command

14 ビュー (過去 30 日間)
Joyce Taylor
Joyce Taylor 2016 年 4 月 30 日
コメント済み: Deep Manvar 2020 年 12 月 22 日
Certainly ,i could change it manually.But using command along with Conditional statements can achieve this process automatically.

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 4 月 30 日
編集済み: Azzi Abdelmalek 2016 年 4 月 30 日
You can read the content of your m-file
fid=fopen('file.m')
line=fgetl(fid);
k=1;
while ischar(line)
out{k,1}=line;
line=fgetl(fid);
k=k+1;
end
fclose(fid)
Insert what you want in the cell array out. Then save it in the original file
fid= fopen('file.m','w')
for k=1:numel(out)
fprintf(fid,'%s\n',out{k})
end
fclose(fid)
  1 件のコメント
Deep Manvar
Deep Manvar 2020 年 12 月 22 日

Wrdbeje

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by