Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
問題があります (オクターブ): = 1 2 3 4 5 があるとしましょう
a.のすべての要素に「b」文字を追加したいので、次のようなものを取得します:a = 1b 2b 3b 4b 5b
それ、どうやったら出来るの?ありがとう
これを可能にするにはa、 double の配列ではなく、文字列として定義する必要があります。もっと洗練された解決策があるかもしれませんが、次のように動作します:
a
a = num2str(1:5); % '1' is a(1), '2' is a(5), etc... % a(2) to a(4) are white spaces for k=2:4:18 a(k) = 'b'; end