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

MATLAB HELP how to ask user for 2 input variables

  1. Jun 14, 2012 #1
    I have an assignment where we have to ask the user for a number of data points which then we will graph a linear regression.

    Enter the number of input data points: 7
    Enter [x y] pair for point 1: [1.1 1.01]
    Enter [x y] pair for point 2: [2.2 2.30]
    Enter [x y] pair for point 3: [3.3 3.05]
    Enter [x y] pair for point 4: [4.4 4.28]
    Enter [x y] pair for point 5: [5.5 5.75]
    Enter [x y] pair for point 6: [6.6 6.48]
    Enter [x y] pair for point 7: [7.7 7.84]

    This is what the program should look like as we are asking the user for the inputs. (The brackets are what the user inputs). How should the code look to get 2 separate variables? Any help would be greatly appreciated!
  2. jcsd
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted

Similar Threads - MATLAB HELP user Date
Matlab MATLab: Not enough inputs for nlinfit Nov 16, 2017
Matlab Help needed to fix a matlab code Nov 8, 2017
New to Matlab, help with vectors Feb 20, 2016
Need help with integral Dec 23, 2015
Matlab help! User defined function! Nov 7, 2012