필터 지우기
필터 지우기

How take value (column number) from one data set (1x15145 double) and find value corresponding to same row and column associated with another data set (1x4579 double)

조회 수: 1 (최근 30일)
I have a value with specific row and column number from one data set s (1x15145 double), and I want to extract value corresponding to same row column number from another data set Time (1x4579 double)

채택된 답변

Walter Roberson
Walter Roberson 2016년 1월 17일
Time(row_from_s, column_from_s)
??
Though with vectors you would normally only use one index.
Example:
[minval, minidx] = min(s);
if minidx > length(Time)
error('Time is too short to get the corresponding position of s');
end
t = Time(minidx);
  댓글 수: 4
Sag
Sag 2016년 1월 17일
편집: Sag 2016년 1월 17일
Actually I want multiple values and then process them all for further processing. I want multiple values from Time. Instead of using row and column numbers Time(row_from_s, column_from_s), can I use A?
Walter Roberson
Walter Roberson 2016년 1월 17일
The result of strfind() is a set of linear indices, not a set of rows and columns. You can use the linear indices to index the vector Time.
You would need to take more care if you were using 2D or multidimensional arrays of different sizes and needed matching row and column numbers, but when you use vectors (or arrays in which all of the dimensions were equal except perhaps the last dimension) then you do not need to worry about that, linear indices are fine. Just don't translate to row and column numbers if you have multiple values.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by