Export excel columns to multiple text files
4 views (last 30 days)
Show older comments
I have excel file with multiple columns. I want to export each column to separated text file. So, I've 1650 columns and the output should be 1650 text file. There is anyway to do it in Matlab or any other method?
Thank you in advance! Majid
0 Comments
Answers (1)
KSSV
on 17 May 2017
You should be reading data from excel file using xlsread. Check the below code.
% data = xlsread('your excel file') ;
% rows = size(data,1) ;
rows = 100 ;
data = rand(rows,1650) ;
% run a loop to save each column into text file
for i = 1:1650
filename = strcat(num2str(i),'.txt') ;
data_col = data(:,i) ;
save(filename,'data_col','-ascii') ;
end
But still, I am surprised why you want each column into a text file though you have them in excel.
2 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!