Info

この質問は閉じられています。 編集または回答するには再度開いてください。

I have finished with my programming about making a script file could anybody help me fix the command?

1 回表示 (過去 30 日間)
John wick
John wick 2019 年 8 月 24 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
This is the command I could think of. Could anybody help me I'm really confused about the question. I don't know how to answer but this is the command i have got until now.
for vector = 1:5
vector = rand(1,6)
end
69009101_873281873042731_1226458611799031808_n.png
  2 件のコメント
Adam Danz
Adam Danz 2019 年 8 月 24 日
編集済み: Adam Danz 2019 年 8 月 24 日
The assignment doesn't specify whether the vectors should be row or column vectors, both could be concatenated horizontally to create either a [6x5] matrix or a [1x30] row vector. There are many ways to accomplish either interpretation and with some trial-and-error and some google'ing you'll succeed!
The code in your question is overwriting the vector on each iteration of the for-loop so you'll always end up with a 1x6 vector.
John wick
John wick 2019 年 8 月 25 日
I really have no idea how to program it...

回答 (1 件)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 8 月 24 日
編集済み: KALYAN ACHARJYA 2019 年 8 月 24 日
vector=cell(1,5);
for i=1:5
vector{i}=rand(1,6);
end
data1=cell2mat(vector)
or you an do concatenate arrays horizontally read here
  1 件のコメント
John wick
John wick 2019 年 8 月 24 日
Is it how I need to answer? I try to use that code and it runs the command and it's a lot more than expected.

Community Treasure Hunt

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

Start Hunting!

Translated by