I want to make a plotmatrix that changes styles depending on what is selected in a dropdown menu. I keep getting errors about the linespec and Im stuck.
Im trying to do something on AppDesigner that looks like this:
everything works except for the 3rd syntax where the dropdown menus should be used.
The error I’m getting is on the button code:
% Button pushed function: PlotButton
function PlotButtonPushed(app, event)
X = str2num(app.XEditField.Value);
Y = str2num(app.YEditField.Value);
% Preluare stiluri
color = app.ColorDropDown.Value;
lineStyle = app.LineStyleDropDown.Value;
marker = app.MarkerDropDown.Value;
lineSpec = strcat([color, lineStyle, marker]);
% Desenarea graficului
figure;
switch app.SyntaxListBox.Value
case ‘plotmatrix(X, Y)’
plotmatrix(X, Y);
case ‘plotmatrix(X)’
plotmatrix(X);
case ‘plotmatrix(X, Y, LineSpec)’
plotmatrix(X, Y, lineSpec);
end
end
the error is this: Error using plotmatrix (line 44) Invalid LineSpec string.
on line 44 is this:lineSpec = strcat([color, lineStyle, marker]);
Im stuck and idk what to do to make it work by this point :(Im trying to do something on AppDesigner that looks like this:
everything works except for the 3rd syntax where the dropdown menus should be used.
The error I’m getting is on the button code:
% Button pushed function: PlotButton
function PlotButtonPushed(app, event)
X = str2num(app.XEditField.Value);
Y = str2num(app.YEditField.Value);
% Preluare stiluri
color = app.ColorDropDown.Value;
lineStyle = app.LineStyleDropDown.Value;
marker = app.MarkerDropDown.Value;
lineSpec = strcat([color, lineStyle, marker]);
% Desenarea graficului
figure;
switch app.SyntaxListBox.Value
case ‘plotmatrix(X, Y)’
plotmatrix(X, Y);
case ‘plotmatrix(X)’
plotmatrix(X);
case ‘plotmatrix(X, Y, LineSpec)’
plotmatrix(X, Y, lineSpec);
end
end
the error is this: Error using plotmatrix (line 44) Invalid LineSpec string.
on line 44 is this:lineSpec = strcat([color, lineStyle, marker]);
Im stuck and idk what to do to make it work by this point 🙁 Im trying to do something on AppDesigner that looks like this:
everything works except for the 3rd syntax where the dropdown menus should be used.
The error I’m getting is on the button code:
% Button pushed function: PlotButton
function PlotButtonPushed(app, event)
X = str2num(app.XEditField.Value);
Y = str2num(app.YEditField.Value);
% Preluare stiluri
color = app.ColorDropDown.Value;
lineStyle = app.LineStyleDropDown.Value;
marker = app.MarkerDropDown.Value;
lineSpec = strcat([color, lineStyle, marker]);
% Desenarea graficului
figure;
switch app.SyntaxListBox.Value
case ‘plotmatrix(X, Y)’
plotmatrix(X, Y);
case ‘plotmatrix(X)’
plotmatrix(X);
case ‘plotmatrix(X, Y, LineSpec)’
plotmatrix(X, Y, lineSpec);
end
end
the error is this: Error using plotmatrix (line 44) Invalid LineSpec string.
on line 44 is this:lineSpec = strcat([color, lineStyle, marker]);
Im stuck and idk what to do to make it work by this point 🙁 plotmatrix, error, linespec MATLAB Answers — New Questions