필터 지우기
필터 지우기

i want to search index number of element (based on condition)in an array and magnitude corresponds to index in matrix

조회 수: 2 (최근 30일)
I have matrices from t1 to t24 (24 matrices of size 122249*25)
time matrix and tof is 4D matrix , when value in time matrix equals (or nearer) in tof matrix i want to find the voltage value from the correspoding matrices which is t1 to t24
here when tt value increases from 1 to 2 , it should search should change from t1 to t2
for tt = 1:24
for rr = 1:24
for mm = 1:10
for nn = 1:50
[~,idx] = min(abs(time(:,1) - tof(mm,nn,rr,tt)));
voltage(mm,nn,rr,tt) =t(tt)[(idx,rr+1)]; %% here is the error
end
end
end
end
when tt value increases subsequently it should start searching in t(tt)???
in code if i write t1(idx,rr+1) it will search in t1 matrix, like wise when tt value increases searching matrix should also change t2,t3,t4,....t24
any help would be appreciated
  댓글 수: 5
M.Prasanna kumar
M.Prasanna kumar 2019년 8월 21일
sorry its a typing mistake,
time is a column vector and tof is 4D matrix
't' is a matrix not a cell
Stephen23
Stephen23 2019년 8월 21일
편집: Stephen23 2019년 8월 21일
See also earlier discussions with M.Prasanna kumar on the same topic:
"it will search in t1 matrix ... should also change t2,t3,t4,....t24"
Do NOT do this.
"any help would be appreciated"'
Simply use indexing, then your task is trivially easy (see links above).

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

답변 (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