How to initialize a cell with all zero values in matlab?

4 ビュー (過去 30 日間)
Roshni gupta
Roshni gupta 2017 年 6 月 16 日
編集済み: Stephen23 2017 年 6 月 16 日
I want a cell array charstring whose every cell is initialized with {000000}. I tried using
charstring={0 0 0 0 0 0 };
but its not working.

回答 (1 件)

KSSV
KSSV 2017 年 6 月 16 日
編集済み: KSSV 2017 年 6 月 16 日
charstring={'0' '0' '0' '0' '0' '0'};
Or
charstring = [repmat({'0'},1,6)] ;
  2 件のコメント
Stephen23
Stephen23 2017 年 6 月 16 日
編集済み: Stephen23 2017 年 6 月 16 日
@KSSV: you might want to think about this a bit more (or actually try it):
charstring = {[repmat('0',1,6]};
Perhaps you really meant to write:
charstring = repmat({'0'},1,6);
KSSV
KSSV 2017 年 6 月 16 日
Yes..you are right.....edited the answer....

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

カテゴリ

Help Center および File ExchangeOther Formats についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by