How to extract the first row and first column of an array of matrix?

109 ビュー (過去 30 日間)
Mr. NailGuy
Mr. NailGuy 2017 年 11 月 16 日
コメント済み: Mr. NailGuy 2017 年 11 月 16 日
I have an array of 10001 elements of which a 2x2 matrix is inside each element. How can I loop thru the array and extract the first row, first column of each matrix?
Will appreciate your feedback.
  4 件のコメント
Stephen23
Stephen23 2017 年 11 月 16 日
編集済み: Stephen23 2017 年 11 月 16 日
@Mr. NailGuy: your array description is wildly inaccurate. The screenshot clearly shows that your array has size 2x2x10001, which means that it actually has 40004 elements.
You might like to consider revising basic MATLAB terminology, if you want to communicate effectively with regular MATLAB users.
Mr. NailGuy
Mr. NailGuy 2017 年 11 月 16 日
Yeah, I might have wrong understanding of the terminology but I already resolve it. Thanks

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

採用された回答

Birdman
Birdman 2017 年 11 月 16 日
a=randi([1 10],2,2,10001);%a numeric array
row=a(1,:,:);
column=a(:,1,:);
  4 件のコメント
Birdman
Birdman 2017 年 11 月 16 日
Reshape it to plot.
elements=reshape(elements,1,10001)
Mr. NailGuy
Mr. NailGuy 2017 年 11 月 16 日
Thanks now working fine.

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

その他の回答 (1 件)

KL
KL 2017 年 11 月 16 日
Use squeeze,
all_first_elements = squeeze(your_matrix(1,1,:));
now, plot like you normally do,
plot(all_first_elements)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by