Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TugboatEng on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

array return in matlab

Status
Not open for further replies.

rekhad

Electrical
Joined
Oct 1, 2005
Messages
1
Location
CA
I am new to MatLab.Please help..

What will the following code generate?
assuming we have data points(0.8,0.5,0.7,0.5,0.3..) between sr(1) to sr(50)

sr=[1 50];
[Y1 I1]=min(abs(data(sr(1):sr(2),:)-0.5),[],1);

Will it first take the absolute difference between data value and 0.5 and return those indexes of I1 for which this difference is minimum.Say I1(4),I1(9)...I1(45) etc.
 
You are supplying possibly greater than a vector and asking a question about a vector. Please, define the problem as a vector only and rephrase the question.

You said this:
data points(0.8,0.5,0.7,0.5,0.3..)

but then gave a code sample that was inconsistent with your question and explanation above:
data(sr(1):sr(2),:)

Can you rethink or rephrase with only 1D going into your min function?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top