avoid overwrite with xlswrite
3 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I'm new in matlab and I'm trying to create an output from a text file. The script works well but until I create the excel file with the same name of the loading data.
Example:
% Load raw data d = load('dritto_dx_6.txt'); ..... ... % Open Excel file.
xlswrite('sac.xls', sac, 'sacbin', 'A2'); xlswrite('sac.xls', sacl, 'sacl', 'A2'); xlswrite('sac.xls', sacr, 'sacr', 'A2');
excelFileName = 'sac.xls'; excelFilePath = pwd; % Current working directory. sheetName = 'Foglio'; % Italian
Does someone know if it is possible to save the excel file with the same name of the loaded file? In other word, when I change the load file (es:dritto_dx_8.txt) the program overwrite data analyzed before (with 'dritto_dx_6.txt') to the new 'sac.xls' file. I need a “connection” so that when I change the load file its changes also the .xls file (maybe calling the excel file with the same name of the txt file to avoid my direct intervention every time changing the .xls filename).
Thnaks
Alessandro
0 件のコメント
回答 (1 件)
Iman Ansari
2013 年 4 月 12 日
Hi. You can use a number after your output file name:
n=1;
excelFileName=sprintf('sac_%d.xls',n);
or
excelFileName=['sac_' num2str(n) '.xls'];
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Spreadsheets についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!