Input string to a matrix or a cell

9 views (last 30 days)
ly
ly on 9 Jul 2016
Commented: per isakson on 10 Jul 2016
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 Comments
Azzi Abdelmalek
Azzi Abdelmalek on 9 Jul 2016
Your question is not clear
ly
ly on 10 Jul 2016
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.

Sign in to comment.

Accepted Answer

per isakson
per isakson on 10 Jul 2016
Edited: per isakson on 10 Jul 2016
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 Comments
per isakson
per isakson on 10 Jul 2016
Replace
data{1}(1,1) = 212;
by
data{1}(1,1) = {212};
per isakson
per isakson on 10 Jul 2016

Sign in to comment.

More Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!