Output in a export data function

조회 수: 2 (최근 30일)
Inti Vanmechelen
Inti Vanmechelen 2015년 12월 27일
답변: Walter Roberson 2015년 12월 27일
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('gait',names2,'B1:G1');
xlswrite('gait',MeanGait,'B2:G101');
xlswrite('gait',StdGait,'Feuil2','B2:G101');
xlswrite('gait',names2,'Feuil2','B1:G1');
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');
end

답변 (1개)

Walter Roberson
Walter Roberson 2015년 12월 27일
? 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, .....)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by