How to save each column in E drive of computer?

2 views (last 30 days)
Faheem Ur Rehman
Faheem Ur Rehman on 15 Apr 2021
Commented: DGM on 15 Apr 2021
I have data of dimension (1024x10000) in workspace i want to save each column in my computer. after saving each column it should like (1024,1).
Thank you
  4 Comments

Sign in to comment.

Accepted Answer

DGM
DGM on 15 Apr 2021
Consider the simple example:
A=rand(500,10); % placeholder data
for f=1:size(A,2)
outname=sprintf('output_%06d.mat',f); % zero-padded sequential filenames
outvec=A(:,f);
save(outname,'outvec');
end
You'll have to adjust the file path and name as needed
  2 Comments
DGM
DGM on 15 Apr 2021
Yes. The example array is a placeholder to demonstrate the concept. I wasn't going to create 10000 files on my computer.
Instead of having a 500x10 array, you have a 1024x10000 array. Replace A with your array.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by