Define EMPTY 20x72 String Array

5 ビュー (過去 30 日間)
Mahmut Yasak
Mahmut Yasak 2016 年 1 月 9 日
回答済み: Walter Roberson 2016 年 1 月 10 日
How can i create empty 20x72 string.
I need empty string to fill the next any process.
These following function is not help to me:
zeros(20,72)
char(' ' *ones(20,72)) ---> I am working with Binary "1" and "0" numbers. This function is not giving to me the true values.

回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 1 月 10 日
Your existing char(' ' *ones(20,72)) gives you a 20 x 72 char array of blanks, and is what you probably need. But what you might be looking for instead is
repmat({''}, 20, 72)
This will be a 20 x 72 cell array, each entry of which is the empty string.
In MATLAB, strings are row vectors of char and the only way to have an array in which each entry is a string, is to use a cell array.

Jan
Jan 2016 年 1 月 9 日
Str = repmat(' ', 20, 72)
Note, that this is a string filled with spaces. An "empty" string has the dimensions [0 x 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