how to convert character array to cell array
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
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 件のコメント
Jyothi Alugolu
2017 年 7 月 25 日
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.
Jyothi Alugolu
2017 年 7 月 25 日
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
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?
Jyothi Alugolu
2017 年 7 月 25 日
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
2017 年 7 月 25 日
@Jyothi Alugolu: and what output do you get?
Jyothi Alugolu
2017 年 7 月 25 日
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
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.
Jyothi Alugolu
2017 年 7 月 25 日
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
2017 年 7 月 25 日
"...I will explain once again..."
I did not ask for you to explain it again. Please see my last comment.
Jyothi Alugolu
2017 年 7 月 25 日
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]).'
Jyothi Alugolu
2017 年 7 月 26 日
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!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)
