Output in a export data function

6 views (last 30 days)
Inti Vanmechelen
Inti Vanmechelen on 27 Dec 2015
Answered: Walter Roberson on 27 Dec 2015
I was trying to create a function to write matrices to excell files. Does anyone know what the right output should be? What I try down here obviously doesn't work because the outputs are excell files, not mat files.
function[gait,stair up,stair down] = exportdata(MeanGait,StdGait,MeanStairUp,StdStairUp,MeanStairDown,StdStairDown)
xlswrite('stair up',names2,'B1:G1');
xlswrite('stair up',MeanStairUp,'B2:G101');
xlswrite('stair up',StdStairUp,'Feuil2','B2:G101');
xlswrite('stair up',names2,'Feuil2','B1:G1');
xlswrite('stair down',names2,'B1:G1');
xlswrite('stair down',MeanStairDown,'B2:G101');
xlswrite('stair down',StdStairDown,'Feuil2','B2:G101');
xlswrite('stair down',names2,'Feuil2','B1:G1');

Answers (1)

Walter Roberson
Walter Roberson on 27 Dec 2015
? You do not have any input named "names2" and you do not create a variable by that name.
[gait,stair up,stair down] is not valid syntax on the left side of "=" in a "function" declaration. It is not permitted in MATLAB to have variables with spaces in the name.
I notice those happen to be the same as the strings you pass as file names for xlswrite. Are you attempting to return the names of the files, or are you attempting to somehow return the files themselves (perhaps in binary form) ?
For xlswrite() it is better to supply the file extension, such as
gaitfile = 'gait.xlsx';
xlswrite(gaitfile, .....)


Community Treasure Hunt

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

Start Hunting!

Translated by