What's the script to have multiple msn's open?

Don't know whats wrong with my matlab script?

  • x = [ 1 2 3 4 5] y = [ 3 5 6 9 2] plotcolor = input('What type of color do you want (r(red) b(blue) or g(green)): ','s'); plottype = input('What type of plot style would you like(cirlce(o) or star(*)): ','s'); pstr = sprintf('%s%s',plotcolor,plottype') plot(x,y,'pstr') the problem is to create a script that will create x and y vectors. then the script will ask the user for a color and for a plot style. it will then create a string pstr that contains the color and plot style, so tat the call to the plot function be plot(x,y,pstr). For example, if the user enter 'blue' and star(*), the variable pstr would contain 'b*' I feel like i have done this exactly but i keep getting an error that reads ??? Undefined function or variable 's'. Error in ==> length at 2 area = sqrt(s*(s-a)*(s-b)*(s-c)); Error in ==> cla at 19 if nargin>0 && length(varargin{1})==1 && ishghandle(varargin{1}) && strcmpi((get(varargin{1},'Type')),'axe… Error in ==> newplot>ObserveAxesNextPlot at 125 cla(ax, 'reset',hsave); Error in ==> newplot at 74 ax = ObserveAxesNextPlot(ax, hsave); Error in ==> peterpan at 6 plot(x,y,'r*')

  • Answer:

    I do not receive the same error as you. However the one thing I see wrong in your script is that you call: plot(x,y,'pstr') A working script for me is: x = [ 1 2 3 4 5]; y = [ 3 5 6 9 2]; plotcolor = input('What type of color do you want (r(red) b(blue) or g(green)): ','s'); plottype = input('What type of plot style would you like(cirlce(o) or star(*)): ','s'); pstr = sprintf('%s%s',plotcolor,plottype); plot(x,y,pstr); The plot function will try to evaluate 'pstr' as a string and not the variable if you use it in quotes. The values 'pstr' are not valid arguments in the color/linetype argument for plot. If you still are receiving errors, try to delete all the variables in your workspace and clean up your script file.

Joseph at Yahoo! Answers Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.