how to convert character array to cell array
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
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
2017년 7월 25일
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...
-"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
"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....
@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...
@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)...
"...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...
reshape(C,[512,20]).'
yeah ok..i got it..thank you soo much..
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
태그
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
