Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab find() function in script

  1. Sep 20, 2010 #1
    SOLVED.
    Hi All!
    Brief version:
    I would like to use statement starting with [ in Matlab script. Is it possible, if yes, how?

    Longer version:
    I'm writing code in matlab. I need to find matrix indices, for which the statement M==10 is true. (I found find() function, which is perfect for the task).

    [r,c]=find[M==10];

    It works perfectly within the command window, but not in my script.
    I get an error message, stating: parse error at '[' ... not valid matlab script
    Can you help, or I must write an algorithm for finding indices? :S

    Thanks in advance!
     
    Last edited: Sep 21, 2010
  2. jcsd
  3. Sep 21, 2010 #2

    Pythagorean

    User Avatar
    Gold Member

    Use (), not [] for the find argument
     
  4. Sep 21, 2010 #3
    Thank you! :) That was the problem. As you can see I'm just started coding in matlab...
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Matlab find() function in script
  1. Create script matlab (Replies: 3)

  2. Matlab - basic script (Replies: 1)

Loading...