フィルターのクリア

How to create a column vector repeating the same character n times?

29 ビュー (過去 30 日間)
Anastasiia Khibovska
Anastasiia Khibovska 2022 年 9 月 27 日
Probably an easy answer, but I am quite stuck on figuring out how to create a character column vector based on a length of another column vector.
I find
cols = length(data) to find how many rows there are, but then how to create a new column vecor that has the same number of rows and has the same character repeating in each row like 'on'.
Thank you for any help!

採用された回答

Matt J
Matt J 2022 年 9 月 27 日
編集済み: Matt J 2022 年 9 月 27 日
and has the same character repeating in each row like 'on'.
'on' contains two characters. Repeating it for N rows would give an Nx2 matrix, not a column vector. Posibly you mean a column vector of strings, like in,
repmat("on",10,1)
ans = 10×1 string array
"on" "on" "on" "on" "on" "on" "on" "on" "on" "on"
  1 件のコメント
Anastasiia Khibovska
Anastasiia Khibovska 2022 年 9 月 28 日
ah thank you! I realize what was the problem now!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by