I have 10 rows and four columns in variable two. I want to write one row in one cell, 2nd row in 2nd cell, 3rd row in 3rd cell and so on into an Excel file using Matlab. How can I do this?

4 ビュー (過去 30 日間)
I have a Matrix in Matlab Workspace having floating point data. The order of the matrix is 10x4. I want to write 1st row in A1 cell, 2nd row in A2 cell, 3rd row in A3 cell and so on into an Excel file using Matlab. How can I do that?
Sadiq Akbar
  1 件のコメント
Guillaume 2019 年 10 月 17 日
Why on earth do you want to do this? Excel does not support having several numbers in a cell, so the only way it can be done is by writing the data as text in the cell (easily done if needed) which would make the data useless for further processing in excel.



xi 2019 年 10 月 17 日
use num2str() to convert your 10X4 numeric matrix into 10 strings.
Then use xlswrite() to write string into Excel cells.
Here's an example
for i=1:size(str,1)
xlswrite(filename, cellstr(str(i,:)), 'Sheet1', ['A',num2str(i)]);
  5 件のコメント
xi 2019 年 10 月 18 日
Hi Sadiq,
I don't get what is the hard part that prevent you from realizing it?
Just make a judgement of whether it is swapped or not and then process it accordingly.
There are many ways you can choose to make such judgement: for example, you can do a pearson correlation between the estimated and the desired, for all the possible mutants upon swapping, and then choose the one with the hightest correlation score.
Sadiq Akbar
Sadiq Akbar 2019 年 10 月 18 日
Thank you very much Xi for your interactive responses. And yes, I solved the problem. Thank you once again.
Sadiq Akbar


その他の回答 (0 件)


Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by