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

1 vue (au cours des 30 derniers jours)
Gerardo Mauleon Ramos
Gerardo Mauleon Ramos le 14 Nov 2019
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 commentaire
Muhammad Usman
Muhammad Usman le 14 Nov 2019
If you are fimiliar with xlsread and xlswrite, then it's quite easy to write the cell by specify filename,sheet,[variable],range

Connectez-vous pour commenter.

Réponses (1)

Stijn Haenen
Stijn Haenen le 14 Nov 2019
You can use the function writematrix:
writematrix(Data,'filename.xlsx')

Community Treasure Hunt

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

Start Hunting!

Translated by