Clear Filters
Clear Filters

xls file read and write (By using loops command)

1 view (last 30 days)
I have a large file (i merged many files into it) which is a 100906 * 9 matrix. Data are occupying 100906 rows and 9 columns. In rows i have 5 different parameters and in column i have 9 different parameters. In the row, the 5 different parameter's data are sequentially arranged. I need to rearrange the row parameters. One option is to convert them to columns. It means that the row parameters will be moved to columns.
what will be the matlab codes?
The parameters in rows (after every five) are repeated and the values for the column parameters are different for the respective row parameters.
I want Matlab to read the row parameter's data and to write them in an excel file as column wise. So ultimately my column parameters number will be 9+5=14, i mean 14 columns, and row numbers will be decreased to 100906/5 = 20181(around). My ultimate need is to put all the parameters either in row wise or in column wise to be inserted them into a software.
By using matlab loops command it could be done. I am a novice in matlab, so facing problems in writing codes. Hints:: Matlab will read the 1st number (data) of the row and then 6th number and then 11th number .... and then write them to a column. Again matlab will read 2nd number (row) and then 7th and then 12th....and write them to another column. In this way matlab will read (3rd--8th--13th--18th..) and (4th--9th--14th...) and (5th--10th--15th...). In an easy way i can say-> matlab will read the first then will not read the subsequent four rows but will read the next (fifth) and then will not read the subsequent four rows and then the next. Because after every 5 rows the parameters are same but their values in column wise are different.
I cannot do it manually because the data are big (more than millions), i have several large files.
Possibly any of you (Matlab expert) can help me to write the codes or alternative ideas.
Thanks in advance.
Mustafa

Answers (1)

Walter Roberson
Walter Roberson on 17 Feb 2012

Community Treasure Hunt

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

Start Hunting!