Matlab question about code

1 回表示 (過去 30 日間)
Francesco
Francesco 2014 年 2 月 6 日
コメント済み: Amit 2014 年 2 月 6 日
>> D_pre
D_pre =
0.2000 0.7000 0.4500 0.1000
0.3000 0.4000 0.3700 0.6000
[righe_d, colonne_d]= size(D_pre)
coordinate=zeros(2, colonne_d)
for i=1:colonne_d
coordinate=D_pre(:,i)
end
I want to have in output all the components of coordinate variables. I have to obtain:
0.2
0.3
and
0.7
0.4
and so on. In coordinate variable I have only the last that I want to obtain. How Can I modify the code?

採用された回答

Amit
Amit 2014 年 2 月 6 日
[righe_d, colonne_d]= size(D_pre)
coordinate=zeros(2, colonne_d)
for i=1:colonne_d
coordinate(:,i)=D_pre(:,i)
end
  1 件のコメント
Amit
Amit 2014 年 2 月 6 日
However if D_pre has the coordinate, you can simply use it as it is in your code? Why copying a variable?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by