error with function save (Unknown command option)

14 ビュー (過去 30 日間)
charles-edouard brault
charles-edouard brault 2017 年 5 月 19 日
回答済み: Tao Zhou 2020 年 4 月 2 日
Hello, I have a problem when I use the save function but I can not find my error (I checked my variables and they are correct):
my code :
for i=1 : Number_of_pages
liste_de_index = Main_Table.Lbl == liste_de_labels(i);
Main_Table_filtered =Main_Table(liste_de_index,1:7);
Main_Table(liste_de_index,:) = [];
save(strcat(Name_Excel,'_table_',num2str(i),'.mat'),'Main_Table_filtered');
warning('off','MATLAB:xlswrite:AddSheet');
clearvars liste_de_index
end
and the command windows send :
Error using save
Unknown command option.
Error in Filter_text_file_and_create_Excel (line
125)
save(strcat(Name_Excel,'_table_',num2str(i),'.mat'),'Main_Table_filtered');
somebody knows ?

採用された回答

Image Analyst
Image Analyst 2017 年 5 月 19 日
I never try to do that much on one line. What happens if you split it up into two lines:
fileName = sprintf('%s_table_%d.mat', Name_Excel, i);
save(fileName, 'Main_Table_filtered');
Do you still get an error? If so, what is it and on which line? And, what does this give you if you type it in the command window:
>> which -all save
  6 件のコメント
charles-edouard brault
charles-edouard brault 2017 年 5 月 23 日
The problem came from the middle score in the name "Name_Excel"
Image Analyst
Image Analyst 2017 年 5 月 23 日
I doubt it. I use underscores in variable names often and there is never a problem. It was probably some other error, like the value of Name_Excel started with a dash like Walter suggested.

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

その他の回答 (1 件)

Tao Zhou
Tao Zhou 2020 年 4 月 2 日
When I had a big data to save I came in this problem too.

カテゴリ

Help Center および File ExchangeIntroduction to Installation and Licensing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by