フィルターのクリア

How to loop through and create an nx2 vector?

4 ビュー (過去 30 日間)
Bobalob
Bobalob 2015 年 3 月 1 日
編集済み: per isakson 2015 年 3 月 1 日
Hi there,
I have a function 'myfunction' that takes a single number as an input and returns a 1x2 vector. How do I perform a loop such that I can create an nx2 vector for multiple input values. I'm trying this but seem to be doing something wrong.
for i = 1:n
output(i) = [myfunction(i)];
end
thanks!

採用された回答

per isakson
per isakson 2015 年 3 月 1 日
編集済み: per isakson 2015 年 3 月 1 日
Try
output = nan( 10, 2 );
for ii = 1:10
output(ii,:) = myfunction(ii);
end
and read
  1 件のコメント
Bobalob
Bobalob 2015 年 3 月 1 日
Thank you very much!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by