Error creating using xlswrite function
Show older comments
Hello all,
I am not an expert in matlab and I am stack right now in a part of my code. The idea is that in my company does not use matlab too much so everything I process in matlab I require to output in excel. '
I work with IFILES from AVL, which are a not common files from combustion analyser software. For these files I use a function developed by matlab:
Normally, I work with a high number of IFILES and therefore, I am trying to automated the script as now I have to do it manually. Right now, I am looping through a folder, acquiring the names of the files, loading these files load_ifile function and saving the variables I am interesting in cell array as IFILE will load to work space as struct. So far, so good. The problem comes when I try to create the name with extension .cvs for create a new cvs files.
The script I have done so far is:
for i=1:2
path='C:\Program Files\MATLAB\R2010a\toolbox\catool';
filePattern=sprintf('*.00%d',i);
files=dir([path '\' filePattern]);
filesnames{i}=files;
%first_name=filesnames{i}.name;
result{i} = load_ifile(filesnames{1,i}.name,1);
for kk=1:4
MFB_5{i,kk}=result{1,i}.(sprintf('AI05_%d',kk)).data';
MFB_10{i,kk}=result{1,i}.(sprintf('AI10_%d',kk)).data';
MFB_50{i,kk}=result{1,i}.(sprintf('AI50_%d',kk)).data';
MFB_90{i,kk}=result{1,i}.(sprintf('AI90_%d',kk)).data';
end
% MFB_combine={MFB_5;MFB_10;MFB_50;MFB_90};
excel_name{i}=cellstr(filesnames{1,i}.name(1:end-4));
Filename{i}=strcat(excel_name{1,i},'.cvs');
xlswrite(Filename{1,i},MFB_5{1,i});
% name=Filename{1,1};
end
Filename is a cell array with the new names for cvs files. I expected to have two cvs files wih the names contained in Filename (that has been previously obtained from the original files). However, it comes out an error that says:
??? Error using ==> xlswrite at 156
Filename must be a string.
Error in ==> test3 at 23
xlswrite(Filename{1,i},MFB_5{1,i});
I am using Matlab R2010a
Any help or guide it would be really appreciated.
Thanks in advanced.
Best regards
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!