×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

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

Students Click Here

Jobs

array return in matlab

array return in matlab

array return in matlab

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

RE: array return in matlab

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?

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.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources