Input string to a matrix or a cell

10 次查看(过去 30 天)
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 个评论
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};

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by