How to merge x and y values to a (x,y) format?

13 ビュー (過去 30 日間)
Berke Özsever
Berke Özsever 2021 年 5 月 10 日
コメント済み: Berke Özsever 2021 年 5 月 28 日
Hello everyone,
Fairly new in matlab, I have a pi_total = zeros(201,sample) matrix which I want to update its values after a loop with the statement (for n = 1:sample) which at the end produces xi_total and yi_total matrices with the dimensions of (201xsample). These matrices represent the x and y positions of the robot "i". I want to combine xi_total and yi_total matrices where I would get a new matrix (lets call it C) with entries in the form of (x,y). I then want to replace/update pi_total with C. I have seen somewhere that this might be done with cell arrays but I couldn't work it out, would really appreciate the help!

採用された回答

KSSV
KSSV 2021 年 5 月 10 日
編集済み: KSSV 2021 年 5 月 10 日
As the dimensions of xi_total and yi_total remain same i.e. 201*1 in the entire loop of length 1:sample; you can save the data into a 3D matrix.
iwant = zeros(201,201,sample) ; % where sample if your value
for n = 1:sample
% do all the calculations, get xi_total, yi_toal whos dimensions are 201*1
% now save the data
iwant(:,:,n) = [xi_total yi_total] ;
end
  1 件のコメント
Berke Özsever
Berke Özsever 2021 年 5 月 28 日
Sorry for the long response and thanks your input was helpful :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLighting, Transparency, and Shading についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by