Input string to a matrix or a cell

조회 수: 9 (최근 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 CenterFile Exchange에서 Structures에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by