reading from excel file and spliting

hi, I have 50 columns data in Excel file. each column have 5000 data. have to segregate each column 5000 data into separate 100 data * 50 files. it should be done for all 50 columns. manually it is very difficult, whether it is possible using Matlab. if possible please anyone help me..

 採用された回答

KSSV
KSSV 2018 年 6 月 20 日

0 投票

[num,txt,raw] = xlsread(myfile) ; % REad data from excel file
[nx,ny] = size(num) ;
pos = 1:nx ;
idx = reshape(pos,[],100) ;
for i = 1:size(idx,2)
A = num(idx(:,i),:) ;
xlswrite(['file',num2str(i),'.xlsx'],A)
end

4 件のコメント

KSSV
KSSV 2018 年 6 月 20 日
[num,txt,raw] = read('data1.xlsx') ;
Use apostrophes for file name.
shrisha tv
shrisha tv 2018 年 6 月 20 日
thank you sir, actually i got the answer upto A = num(idx(:,i),:) ; but xlswrite(['file',num2str(i),'.xlsx'],A) this step is not running. showing error. and also it is forming only one set of data for 50*100. i need entire 5000 data of each column in the same manner. please help me.
shrisha tv
shrisha tv 2018 年 6 月 20 日
this is a error Error using xlswrite (line 226) Invoke Error, Dispatch Exception: Source: Microsoft Office Excel Description: Microsoft Office Excel cannot access the file 'C:\Program Files\MATLAB\R2017a\testing data\F7C90520'. There are several possible reasons:
• The file name or path does not exist. • The file is being used by another program. • The workbook you are trying to save has the same name as a currently open workbook. Help File: C:\Program Files (x86)\Microsoft Office\Office12\1033\XLMAIN11.CHM Help Context ID: 0
Error in spliting1 (line 7) xlswrite(['filew1',num2str(i),'.xlsx'],A);
KSSV
KSSV 2018 年 6 月 20 日
This is problem with xlswrite......you may store into someother format....

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeData Import from MATLAB についてさらに検索

質問済み:

2018 年 6 月 20 日

コメント済み:

2018 年 6 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by