if i have a cell array 11*1000 elements,and i want to write every each one column vector from the 1000 columns to an excel sheet or file in one command what do i have to?

답변 (1개)

dpb
dpb 2019년 8월 9일
편집: dpb 2019년 8월 10일

0 개 추천

Follow the documentation--for xlswrite, every cell element has to be a single value. So, if your array has cells (or any single cell) containing more than one element per each, you've got to expand it first.
W/ R2019a, TMW has introduced writecell and deprecated xlswrite I don't have the release so can't test but same caveat on cell array content is implied albeit not explicitly stated and it says uses '%g' as a format so may not reproduce data as does xlswrite.

댓글 수: 2

Hussein Ayoub
Hussein Ayoub 2019년 8월 10일
RunActivityData_mat=cell2mat(RunActivityData); 11*1000 single element cell
i have tried this code ,i want to write every column to excel sheet.
for Write_data=1:size(RunActivityData_mat,2);
WrittienDurations= RunActivityData_mat(:,Write_data);
myfilename = sprintf('file%d.xlsx', Write_data);
xlswrite(myfilename, WrittienDurations,'TASK','B1:B11');
end
it is done .
but it is not good because there is a huge number of excel sheets ,i try to fit this problem
dpb
dpb 2019년 8월 10일
Just write the array...RunActivityData_mat is an array, just write it instead making up eleven files.
xlswrite(myfilename, cell2mat(RunActivityData),'TASK','B1');
is all you need other than to create a meaningful filename.

댓글을 달려면 로그인하십시오.

카테고리

제품

릴리스

R2016a

태그

질문:

2019년 8월 9일

댓글:

dpb
2019년 8월 10일

Community Treasure Hunt

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

Start Hunting!

Translated by