How do you write a string inside a cell ?

4 ビュー (過去 30 日間)
Marco
Marco 2012 年 12 月 12 日
Hi,
I have a empty 2x2 cell C since
C = cell(2,2);
Now, I have 2 strings to put as 1st column of C, they are:
'String 1'
and
'String 2'
but when I write:
C{:,1} = {'String 1' ; 'String 2'}
It returns the error:
The right hand side of this assignment has too few values to satisfy
the left hand side.
Can't I write inside a cell like an array as above ?
(in array in matlab as above C(:,1) = [2;3]; is allowed)

採用された回答

Walter Roberson
Walter Roberson 2012 年 12 月 13 日
C(:,1) = [{'String 1'}; {'String 2'}];
  1 件のコメント
Jan
Jan 2012 年 12 月 13 日
Or:
C(:,1) = {'String 1'; 'String 2'}

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by