×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Help using the FIND function

## Help using the FIND function

(OP)
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

### RE: Help using the FIND function

You're going to have to provide more detail.

Give us an X1 sample array and a bt01 value.

### RE: Help using the FIND function

So what does "whos" give you?  I.e. what is bt01?

### RE: Help using the FIND function

(OP)
X1=7.5:0.0001:70;

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

Thanks,
Chris

### RE: Help using the FIND function

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.

### RE: Help using the FIND function

(OP)
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);

### RE: Help using the FIND function

(OP)
Sorry,

The second to last line should read

inx01 = find(X1==bt01);

I copied from the wrong part of the script.

### RE: Help using the FIND function

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).

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!