Export excel columns to multiple text files
4 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
KSSV
2017-5-17
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!