Make a variable

1 回表示 (過去 30 日間)
Alexandros
Alexandros 2011 年 11 月 25 日
I have to make a variable which has the sign %s as many times as the variable x is.
This means if x = 15 then i need to make
B = [%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s]
While also keep the spaces between them. So I can paste it into textscan.
Is there a way to produce B. I could make B as 2 columns one for % and one for s but when I transpose it the result is completely wrong.
%%%%%%%%%%%%%% ssssssssssssss
Any ideas? Thank you very much

採用された回答

Titus Edelhofer
Titus Edelhofer 2011 年 11 月 25 日
Hi,
B = repmat('%s ', 1, x);
Titus
  1 件のコメント
Alexandros
Alexandros 2011 年 11 月 25 日
Yes MANNNNNNN
THANK YOU AMAZINGGGGGGGGGGGGGGGGGGGGG

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by