Problem with matrices. Double and cell
古いコメントを表示
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 件のコメント
madhan ravi
2019 年 8 月 1 日
編集済み: madhan ravi
2019 年 8 月 1 日
please attach your data as .mat file
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?
採用された回答
その他の回答 (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 件のコメント
Ivan Mich
2019 年 8 月 1 日
madhan ravi
2019 年 8 月 1 日
編集済み: madhan ravi
2019 年 8 月 1 日
Could you attach your file as .mat ? , asking it for the second time.
Ivan Mich
2019 年 8 月 1 日
Walter Roberson
2019 年 8 月 1 日
We need the full error message showing what matlab thinks is wrong.
Ivan Mich
2019 年 8 月 1 日
Walter Roberson
2019 年 8 月 1 日
At the command line give the command
dbstop if error
and then run the code. When the problem occurs, try these and see which ones give an error and show us the error:
Nc = [CT(1), num2cell(CT{2}), CT(3), num2cell(CT{4}), num2cell(CT{5})]
Nc = [CT(1), num2cell(CT{2}), CT(3), num2cell(CT{4})]
Nc = [CT(1), num2cell(CT{2}), CT(3)]
Nc = [CT(1), num2cell(CT{2})]
Nc = [CT(1)]
Ivan Mich
2019 年 8 月 2 日
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.
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!