필터 지우기
필터 지우기

create an array contain no of string adding one by one

조회 수: 1 (최근 30일)
Partha
Partha 2012년 11월 2일
I would like to create an array in such a way that suppose the first element is 'Hi', second element is 'I', third element is 'am' and so on e.g. array(1) = 'Hi' array(2) = 'I' array(3) = 'am' array(4) = 'ABCD'

채택된 답변

Walter Roberson
Walter Roberson 2012년 11월 3일
편집: Walter Roberson 2012년 11월 3일
This is something that cannot be done in MATLAB. Azzi's answer shows the closest you can get, but for it instead of A(1) being 'Hi', instead A(1) would be {'Hi'} which is a cell array instead of a string. A{1} would be the string 'Hi' though.
array{1} = 'Hi'
array{2} = 'I'
array{3} = 'am'
array{4} = 'ABCD'

추가 답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2012년 11월 2일
A={'Hi','I','am','ABCD'}

Partha
Partha 2012년 11월 3일
Mr Roberson
Thanks for your answer. But actually i want to insert (or assigned) 'Hi','I','am','ABCD' one by one in A. How can i do this? Please help me.

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by