How to save data stored in a cell for easy transfer to excel?
1 view (last 30 days)
Show older comments
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 Comment
Muhammad Usman
on 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
Answers (1)
Stijn Haenen
on 14 Nov 2019
You can use the function writematrix:
writematrix(Data,'filename.xlsx')
0 Comments
See Also
Categories
Find more on Spreadsheets in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!