Find the corresponding value of y when x is a specific value?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a 369 x 2 x 27 matrix. The 369 rows (x value) are from 230:598. I want to find the corresponding y value when x-value is equal 280. Then, make a table with 1:27 on the first column and the corresponding values as the second column. Can anyone please advice me how to do it?
Thank you so much!!
댓글 수: 0
채택된 답변
Voss
2022년 5월 18일
Maybe this
% a 3D array like yours
M = [(230:598).' rand(369,1)]+reshape(0:5:130,[1 1 27]);
size(M)
% find the row of M(:,1,1) where 280 is
row_idx = find(M(:,1,1) == 280,1);
% make the table
T = table((1:size(M,3)).',permute(M(row_idx,2,:),[3 2 1]));
head(T)
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Tables에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!