How to save data stored in a cell for easy transfer to excel?

1 回表示 (過去 30 日間)
Gerardo Mauleon Ramos
Gerardo Mauleon Ramos 2019 年 11 月 14 日
回答済み: Stijn Haenen 2019 年 11 月 14 日
I have data stored in excel based on timepoints. I wrote a small code that sepatates the data into intensities based on the time point indicated (Time 1, Time 2, etc.)
----------------------------------------------------------------------------------------------
[~,idx] = sort(data(:,2));
sortedmat = data(idx,:);
[~,~,X] = unique(sortedmat(:,2));
C=accumarray(X,1:size(sortedmat,1),[],@(r){sortedmat(r,:)});
Time = data(:,2) ;
Intensity = data(:,1) ;
[c,ia,ib] = unique(Time) ;
answer = cell(length(c),1) ;
for i = 1:length(c)
answer{i} = Intensity(ib==i,:) ;
end
-----------------------------------------------------------------------------------------------
However, the data is stored in a cell with individual "NX1 double" values. So far I have opened every single one of them and then copy and paste them into excel where i do the analysis. But my data sets are starting to become bigger and I am wondering if there is an easy way to either save them to a matrix that I can copy and paste to excel or another way to save them.
Thank you
  1 件のコメント
Muhammad Usman
Muhammad Usman 2019 年 11 月 14 日
If you are fimiliar with xlsread and xlswrite, then it's quite easy to write the cell by specify filename,sheet,[variable],range

サインインしてコメントする。

回答 (1 件)

Stijn Haenen
Stijn Haenen 2019 年 11 月 14 日
You can use the function writematrix:
writematrix(Data,'filename.xlsx')

カテゴリ

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