How to change color of the plot when it is called in evalin function?

1 view (last 30 days)
Hello everyone, I am trying to plot the variables from the workspace. I have to plot three different variables together on the same plot with different colors. My code looks likes this : try
evalin('base',['plot(',a,',',x,')'])
grid on
hold on
evalin('base',['plot(',a,',',y,')'])
hold on
evalin('base',['plot(',a,',',z,')'])
catch ex
errordlg(...
ex.getReport('basic'),'Error generating linear plot','modal')
end
How can i make changes in evalin command so as to make plots of different color for each variable set. Please help

Answers (1)

Adam
Adam on 23 Sep 2014
Edited: Adam on 23 Sep 2014
Can't you just add:
'color',someColour
to your evalin line in whatever is the correct syntax if you really have to use evalin? I've never used it myself, but judging from what you have done so far I don't see why just adding another couple of arguments to the plot function wouldn't work.
I get a syntax error when I try to run the first line of your code so I gave up on my attempt to get the right syntax for adding in the 'color' argument myself.

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!