save the the file into excel

Hi, I have a lone code with about 7 variables Im trying to save into excel sheet with the variables names as headline and the data into the column of that headline. all the varables are matrix 20x1 and the names are listed below.
r_coords
extracted_data
r_exper
V_exper
V_interpolation
Absuolut_Error
Relative_Error
filename = (sprintf('monitor_line_%d_ degree %.1fCA_%s', Monitor_line, CrankAngle, upper(variable)));
Results_Names={'r_coords','extracted_data','r_exper','V_exper','V_interpolation','Absuolut_Error','Relative_Error'};
Results_Values=[r_coords,extracted_data,r_exper,V_exper,V_interpolation,Absuolut_Error,Relative_Error];
sheet=1;
xlswrite('filename.xlsx',Results_Values,sheet);

5 Comments

Results_Values=[r_coords,extracted_data,r_exper,V_exper,V_interpolation,Absuolut_Error,Relative_Error;
is missing closing brace for starters...
thank you but that not the case, it just happened as I copyed over.
here is the error message I'm getting when I run the code
Error using horzcat
Dimensions of arrays being concatenated are not consistent.
Error in ExtractMonitorData (line 128)
Results_Values=[r_coords,extracted_data,r_exper,V_exper,V_interpolation,Absuolut_Error,Relative_Error];
>>
dpb
dpb on 15 Dec 2019
Edited: dpb on 15 Dec 2019
Then all the arrays are NOT 20x1 like you think.
See which is different...particularly, perhaps one (or more) are row, not column vectors.
yes after i checked 2 of the variables 40x1 so I took them off to see if the code will work but i got a different error
filename = (sprintf('monitor_line_%d_ degree %.1fCA_%s', Monitor_line, CrankAngle, upper(variable)));
Results_Names={'r_coords','extracted_data','r_exper','V_exper','V_interpolation','Absuolut_Error','Relative_Error'};
Results_Values=[r_exper,V_exper,V_interpolation,Absuolut_Error,Relative_Error];
xlswrite('filename.xlsx',Results_Values);
winopen('testdata.xls');
here is the Error
Error using xlswrite (line 224)
The file O:\Research\research\filename.xlsx is not writable. It might be locked by another process.
Error in ExtractMonitorData (line 129)
xlswrite('filename.xlsx',Results_Values);
so is there anyway I can save them even if the array dimenssion does not agree like 40x1 and 20x1 ?
Sorry for make it this long question. thanks in advance
The file O:\Research\research\filename.xlsx is not writable.
It might be locked by another process.
That has nothing to do with the data; the file is locked...already opened by Excel. You either have it open for edit or possibly there's a zombie process left after a previous try w/ xlswrite that didn't manage to clean up gracefully.
Close all instances you can see (if any) manually, then open the Task Manager and kill any Excel process that show up (kill the tree).
If all else fails, restart your system.

Sign in to comment.

Answers (0)

Categories

Asked:

on 14 Dec 2019

Commented:

dpb
on 15 Dec 2019

Community Treasure Hunt

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

Start Hunting!