Prev: How to make list out of my outdata
Next: Simulink
From: subbu on 12 May 2010 22:33 I have a single row matrix with 121 columns. I want to make a new matrix with first 10 elements as 1st row, second 10 elements as 2nd row,.......12 rows and last row has a single element. is there a command to do this? because i need to repeat this step for a big matrix of dimension 21 x 121. please help me. thank you in advance cheers
From: us on 12 May 2010 22:43 "subbu " <ysrhcu(a)yahoo.com> wrote in message <hsfod0$nhj$1(a)fred.mathworks.com>... > I have a single row matrix with 121 columns. I want to make a new matrix with first 10 elements as 1st row, second 10 elements as 2nd row,.......12 rows and last row has a single element. > > is there a command to do this? because i need to repeat this step for a big matrix of dimension 21 x 121. > > please help me. > > thank you in advance > > cheers a hint: help reshape; us
From: Matt J on 12 May 2010 23:39 "subbu " <ysrhcu(a)yahoo.com> wrote in message <hsfod0$nhj$1(a)fred.mathworks.com>... > I have a single row matrix with 121 columns. I want to make a new matrix with first 10 elements as 1st row, second 10 elements as 2nd row,.......12 rows and last row has a single element. > > is there a command to do this? =============== No. All rows of a matrix in MATLAB have to have the same number of elements. You cannot have a matrix with 10 elements in some rows and a single element in the final row.
From: subbu on 13 May 2010 14:00 "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hsfs8o$19p$1(a)fred.mathworks.com>... > "subbu " <ysrhcu(a)yahoo.com> wrote in message <hsfod0$nhj$1(a)fred.mathworks.com>... > > I have a single row matrix with 121 columns. I want to make a new matrix with first 10 elements as 1st row, second 10 elements as 2nd row,.......12 rows and last row has a single element. > > > > is there a command to do this? > =============== > > No. All rows of a matrix in MATLAB have to have the same number of elements. You cannot have a matrix with 10 elements in some rows and a single element in the final row. Hi, It will still be a 21x121 matrix. But i need this matrix as an input to other code that im running, and that code accepts the file only if it is in "10f10.3" format. Thats why i need to decompose this matrix. doing it manually 121 times is a bit cumbersome. It will be good to know if there is any command that can do this job. cheers thanks in advance
From: Mark Shore on 13 May 2010 14:21
"subbu " <ysrhcu(a)yahoo.com> wrote in message <hshenl$5mm$1(a)fred.mathworks.com>... > "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hsfs8o$19p$1(a)fred.mathworks.com>... > > "subbu " <ysrhcu(a)yahoo.com> wrote in message <hsfod0$nhj$1(a)fred.mathworks.com>... > > > I have a single row matrix with 121 columns. I want to make a new matrix with first 10 elements as 1st row, second 10 elements as 2nd row,.......12 rows and last row has a single element. > > > > > > is there a command to do this? > > =============== > > > > No. All rows of a matrix in MATLAB have to have the same number of elements. You cannot have a matrix with 10 elements in some rows and a single element in the final row. > > Hi, > It will still be a 21x121 matrix. But i need this matrix as an input to other code that im running, and that code accepts the file only if it is in "10f10.3" format. > Thats why i need to decompose this matrix. > > doing it manually 121 times is a bit cumbersome. It will be good to know if there is any command that can do this job. > > cheers > thanks in advance At a certain point it will be necessary for you to look at the answers and suggestions you've already been given, read the MATLAB documentation on file output formats and commands, and solve your own simple problem. |