1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Matlab input function

  1. Aug 28, 2008 #1
    Hi all,
    Can someone please help me with my matlab code. I am trying to get the program to quite if the user tries to input a non-numeric value, and will display an error message. I have got it to work useing the matlab input('promt','s') command, but i dont want to use this command because a user cant enter 5/100 etc.
    Here is my code.

    Code (Text):
    j = input('number?:')
    if isnan(j)==1
        disp('Input must be a number, Function will terminate')
        return
    end
    I would just like to know if there is a simply way to do this, if not I will use the command I used before and use the eval function I think...

    Thank You

    Regards Elbarto
     
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you help with the solution or looking for help too?
Draft saved Draft deleted



Similar Discussions: Matlab input function
  1. Matlab cell functions (Replies: 0)

Loading...