Stacking Matrices One after Another to make a final matrix

8 ビュー (過去 30 日間)
Chris Dan
Chris Dan 2020 年 8 月 23 日
コメント済み: Cris LaPierre 2020 年 8 月 23 日
Hello,
I have different matrices( each matrix has size of 2x4 ) stored in a file as a cell array, I am adding them together with the following code:
I have also attached the file and the pictures with the question.
for i =1:1:(size(Identify_3,1)-1)
Final_Matrix = [Identify_3{i, 1}{1, 3};Identify_3{i+1, 1}{1, 3}]
end
The problem is I am not getting correct results.
Does anybody know...?

採用された回答

Cris LaPierre
Cris LaPierre 2020 年 8 月 23 日
Does this do what you want?
step1 = vertcat(Identify_3{:})';
step2 = vertcat(step1{:})
I noticed that, because some of the values are imaginary, all numbers in the combined matrix will have an imaginary component, though some of them are just 0i.
  2 件のコメント
Chris Dan
Chris Dan 2020 年 8 月 23 日
Thanks :)
I have made the changes I needed to do
load('Matrices.mat')
step1 = vertcat(Identify_3{:})';
step1(1,:) = []
step1(1,:) = []
step2 = vertcat(step1{:})
Cris LaPierre
Cris LaPierre 2020 年 8 月 23 日
Ah, missed that subtlety. Well, a simple modification in the indexing is all you need.
step1 = vertcat(Identify_3{:});
step2 = vertcat(step1{:,3})

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by