How to extract the first row and first column of an array of matrix?
조회 수: 25 (최근 30일)
이전 댓글 표시
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
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.
채택된 답변
Birdman
2017년 11월 16일
a=randi([1 10],2,2,10001);%a numeric array
row=a(1,:,:);
column=a(:,1,:);
댓글 수: 4
추가 답변 (1개)
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 Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!