Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Help using the FIND function

Status
Not open for further replies.

Chris31

New member
Jul 20, 2007
19
Hi all,

Quick question - I'm tryin to implement the following line of code:

inx01=find(X1==bt01);

and I get the error ??? Error using ==> find
Second argument must be a positive scalar integer.

If I replace bt01 with the value it works, but I need to leave this as bt01. Is there a way to work around this?

Thanks,
Chris
 
Replies continue below

Recommended for you

You're going to have to provide more detail.

Give us an X1 sample array and a bt01 value.
 
X1=7.5:0.0001:70;

bt01=(Htotal-2*Rbulb-Tflange)/Ttee; % which equals 8.8095 for this case

Thanks,
Chris
 
The error message you are getting seems to need a comma in your input argument list for "find". Did you give us the exact code? Or an edited version. Please, show the exact lines of code and show us the value for bt01 in long format on.

 
X1=7.5:0.0001:70;
Y1=interp1(x_1EF,yfit,X1);
plot(X1,Y1,'r');

bt01=(Htotal-2*Rbulb-Tflange)/Ttee;
inx01 = find(X0==bt01);
Z01=Y0(inx01);
 
Sorry,

The second to last line should read

inx01 = find(X1==bt01);

I copied from the wrong part of the script.
 
Sorry but X1 never equals bt01.

You may be thinking the index is 13096, but bt01 has more precision than shown, so find doesn't find an exact index. Try rounding it to 4 places. Maybe better solution would be to fit the data to a shifted spline and look for a zero (reverse interpolation).

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor