finding a value from a point in a table

조회 수: 6 (최근 30일)
jason
jason 2022년 10월 20일
편집: Cris LaPierre 2022년 10월 20일
I have a mat file with data like this, and I want to pull values that correspond to the blue numbers instead of the red numbers. For example, I am unable to find a value for (10,6).
  댓글 수: 1
dpb
dpb 2022년 10월 20일
Absolutely useless image -- attach some real data as text and show us the actual code used and then explain what it is you're after...if you have an array M, then
M(10,6)
is the value at that location...surely there must be more to the issue than that.

댓글을 달려면 로그인하십시오.

채택된 답변

Cris LaPierre
Cris LaPierre 2022년 10월 20일
편집: Cris LaPierre 2022년 10월 20일
So you want to use your own indexing scheme to extract data from your array. It's possible, but is going to be a bit convoluted.
tbl = randi(10,[6,7]);
tbl(1,2:end) = 0:2:10;
tbl(:,1) = [0,0:2:8]
tbl = 6×7
0 0 2 4 6 8 10 0 3 4 8 5 10 1 2 3 2 9 5 3 8 4 7 9 3 9 7 10 6 1 5 6 8 7 3 8 3 9 9 6 5 8
% use logical indexing to create and indes for where the row in the
% first column that is 6 and column in the first row that is 10
val = tbl(tbl(:,1)==6,tbl(1,:)==10)
val = 3

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by