how i can change this string array into one row and multiple columns.

2 ビュー (過去 30 日間)
Mohamuud hassan
Mohamuud hassan 2015 年 5 月 19 日
編集済み: Stephen23 2015 年 5 月 19 日
hello every one; how i can change this string into one row and multiple columns. for example:
daalo= {'000001001001010111100101111111001101001111001101000000010000001011011110100110101001010101000111001111110101111010010000110010111110111110000000000000000000'};
how i can change the format into;
daalo:{0;0;0;0;0;1;0;0;1;0;0;1;0;1......... until las digit?
  1 件のコメント
Stephen23
Stephen23 2015 年 5 月 19 日
編集済み: Stephen23 2015 年 5 月 19 日
@abdulkarim hassan: stop putting everything in cell arrays. Cell arrays are great, but if you don't need them then they just make your code more complicated and slower. Learn to use MATLAB's basic data types and your own code will be much simpler and faster: James Tursa's answer shows how using basic data types can be much neater code and much faster to calculate with.

サインインしてコメントする。

採用された回答

James Tursa
James Tursa 2015 年 5 月 19 日
編集済み: James Tursa 2015 年 5 月 19 日
Your syntax in the question specifies a cell array output of double values, so here is how to do that:
n = numel(daalo{1});
result = mat2cell(daalo{1}-'0',1,ones(1,n));
If you want a column result, then
result = mat2cell(daalo{1}-'0',1,ones(1,n))';
Do you really need a cell array containing individual double numbers for your downstream processing, and not a simple double array? E.g., would this be better for your downstream processing?
result = daalo{1}-'0'; % double row vector result

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by