Input string to a matrix or a cell

11 ビュー (過去 30 日間)
ly
ly 2016 年 7 月 9 日
コメント済み: per isakson 2016 年 7 月 10 日
Hi,
I have a string and want to input it to a matrix or a cell.
string: name
matrix: A(2,3)
cell: data{2}(2,4);
Could you help?
  2 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2016 年 7 月 9 日
Your question is not clear
ly
ly 2016 年 7 月 10 日
I want to input string to position (2,3) of matrix A and position (2,4) of cell data{2}.
You can see in attached figure.

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

採用された回答

per isakson
per isakson 2016 年 7 月 10 日
編集済み: per isakson 2016 年 7 月 10 日
Cell array
>> data = cell( 1, 3 );
>> data{2} = cell(3,6);
>> data{2}{2,4} = 'Hello World';
or
>> data{2}(2,4) = {'Hello World'};
With a Matrix it is not practical. "A(2,3)" would address one character.
  3 件のコメント
per isakson
per isakson 2016 年 7 月 10 日
Replace
data{1}(1,1) = 212;
by
data{1}(1,1) = {212};
per isakson
per isakson 2016 年 7 月 10 日

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by