Problem with matrices. Double and cell
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I have a problem with a matlab code. The problem is that I want to make o txt file with my results. I am using the command "writetable" nut there is a problem with matrixes. In the picture I show you the format of the matrices.
How can I convert cell to double In order to make this code?
P.S. I ve tried commands : cell2table,table2array, but it doesn't works...
Thank you
댓글 수: 3
Eva-Maria Weiss
2019년 8월 1일
For converting cell arras to double array, you could use cell2mat:
Luna
2019년 8월 1일
To answer this, we must see what is inside the cell array. Could you please share it?
채택된 답변
Andrei Bobrov
2019년 8월 2일
for ii = 1:numel(CT)
if ~iscell(CT{ii})
CT{ii} = num2cell(CT{ii});
end
end
T = cell2table(cat(2,CT{:}));
writetable(T,'youtxtfile.txt')
댓글 수: 0
추가 답변 (1개)
Walter Roberson
2019년 8월 1일
Nc = [CT(1), num2cell(CT{2}), CT(3), num2cell(CT{4}), num2cell(CT{5})];
writecell(Nc, filename)
This requires r2019a or later, but we know that you have that because writematrix is introduced at the same time.
댓글 수: 9
Walter Roberson
2019년 8월 13일
It is not possible to get that error from
Nc = [CT(1)]
But in the meantime, please tell use more about CT{3} which your display indicates is a cell array.
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!