Create Plot based on calculated values

Hello everybody,
i think my problem isn't that hard but i cant figure out a perfect solution in Matlab App Designer.
I would like to shot my analysation in the GUI and therefore i created a diagramm.
Now i would like to show three different values over 3 different situations.
So for example Situation A / Situation B and Situation C on the X-Axis and the Values 80, 70 60 on the plot and the y Axis.
How can i manage this?
Thanks for your help!

4 comentarios

DGM
DGM el 25 de Mayo de 2022
What sort of plot exactly are you describing? It sounds like a bar chart, but I can't tell.
Tim
Tim el 25 de Mayo de 2022
i think perfect would be a plot with 3 points on the calculated values and maybe a line between the points to unterstand the evolution of them
Walter Roberson
Walter Roberson el 25 de Mayo de 2022
categorical() for the x values, maybe for the y as well
dpb
dpb el 25 de Mayo de 2022
Editada: Walter Roberson el 26 de Mayo de 2022
Have you looked at/read syntax/examples of plot? Or is the Q? how to put a plot on/in the app? When you open the AppDesigner, there are several examples that contain plots not dissimilar from what you describe; begin with one of those and see how it's done there.

Iniciar sesión para comentar.

Respuestas (1)

Ravi
Ravi el 25 de Sept. de 2023
Hi Tim
Based on my understanding, it appears that you are facing a situation where you need to plot three different scenarios on the same set of axes. Allow me to propose a potential solution to address this matter.
To tackle this issue, please refer to the following code snippet where I have considered the following scenarios:
Situation A - a linear equation ();
Situation B - a quadratic equation (); and
Situation C - a cubic equation ().
Within the app, there is a "Generate" button that, when clicked, will display the desired plots.
The logic for plotting resides within the "Generate" button callback function that is “GenerateButtonPushed”. The linear equation, and the anonymous functions, square and cube can be modified to meet your requirements. In this example, I have considered the x-axis points to be integers from 1 to 5 inclusive.
% Button pushed function: GenerateButton
function GenerateButtonPushed(app, event)
x = 1:5;
square = @(x) x.*x;
cube = @(x) (x.*x).*x;
yA = x;
yB = square(x);
yC = cube(x);
plot(app.UIAxes, x, yA, x, yB, x, yC);
end
It is worth noting that all three scenarios can be plotted using a single plot function by passing the appropriate x-y pairs as arguments. Additionally, please keep in mind that the x-axis entries for each scenario can also be distinct if necessary.
Please refer to the following documentation for more insights and examples on plotting in AppDesigner.
Hope this helps.

Categorías

Más información sobre Develop Apps Using App Designer en Centro de ayuda y File Exchange.

Productos

Versión

R2021b

Etiquetas

Preguntada:

Tim
el 25 de Mayo de 2022

Respondida:

el 25 de Sept. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by