avoid overwrite with xlswrite
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Iman Ansari
am 12 Apr. 2013
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 Kommentare
Siehe auch
Kategorien
Mehr zu Spreadsheets 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!