hello, i have a char array of size 1280 * 8 ... values like 11111111 01010101 10100101 ........ 01010101 Now i want as 1*10240 cell array (since 1280 * 8 =10240)...output must be 1,1,1,1,1,1,1,1,0,1,0,1,0,1,0,1.....i used str2num ..but they were being conatanated as vertical..i want to conctanate horizantally/..

 채택된 답변

Stephen23
Stephen23 2017년 7월 25일

0 개 추천

num2cell(reshape(X.',1,[]))

댓글 수: 13

and now i want this A cell array having size 1*10240 as 20 * 512... i used reshape(A,[20,512])...but those are conacatanating vertically...
Stephen23
Stephen23 2017년 7월 25일
편집: Stephen23 2017년 7월 25일
-"but those are conacatanating vertically..."_
I have no idea what that means. The code I gave puts each element of the input char array into one cell. Perhaps you should check the size of the input char array.
i got befor one...thanks for that now am asking new one...i have a cell array "A" of size 1*10240...i want this cell array as 20 * 512 size... i used reshape(A,[20,512])....but that is not correct
Stephen23
Stephen23 2017년 7월 25일
"but that is not correct"
I have no idea what that means. Do you mean that your algorithm is incorrect, or that the code is correct but give an unexpected output, or that the code throws an error? If so, what is the complete error message?
I am getting unexpected output.. If cell array is like 1 0 0 1 0 1 0 1 0 0 ...... 1 0 1 (size 1*10240)... now i want output as 1 0 0 1 0 1 0 0....(upto 20 values) next 20 values...so on upto 512 columns....
Stephen23
Stephen23 2017년 7월 25일
@Jyothi Alugolu: and what output do you get?
i got output as 20 * 512 only...but values are not correct... values are splitting in vertical order..i want them to split in horizintal way...
Stephen23
Stephen23 2017년 7월 25일
@Jyothi Alugolu: I am happy to help you but you need to be much more precise in your description. Please provide a small sample input data and the expected output data. You can upload files by clicking the paperclip button.
Thanks for bearing me... I will explain once again I have a cell array "A" having 0's and 1's of size 1*10240... Now, i want the output cell array of size 20 * 512.. i.e i cell array needs to be spitted with 20 rows and 512 columns since 20 * 512= 10240...i.e first 512 values in 1st row and then next row must start with 513 th cell value...i used reshape command...what i am getting is wrong..what i got is first 20 values are in 1st column and 2nd column starts with 23rd cell value...but what i want is rowwise splitting... i used reshape(A,20,512)...
Stephen23
Stephen23 2017년 7월 25일
"...I will explain once again..."
I did not ask for you to explain it again. Please see my last comment.
i have attached 2 files...f1{1,1} cell size is 1*10240...n the output cell f{1,1} is of size 20 * 512.. i want f1 cell array values to split horizontally..i.e 1st 512 values in 1st row and 2nd row must start with 513th value...but what i got in f{1,1} is first 20 values in 1st column and 2nd column starts with 21st value..i want values to split rowwise..not as columnwise...
Stephen23
Stephen23 2017년 7월 25일
편집: Stephen23 2017년 7월 25일
reshape(C,[512,20]).'
Because MATLAB is column-major, so matrix vectorization goes along the columns first.
yeah ok..i got it..thank you soo much..

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2017년 7월 25일

댓글:

2017년 7월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by