Code of plotting from SCOPE three axis to sublots

9 vues (au cours des 30 derniers jours)
Povi Nike
Povi Nike le 18 Juil 2012
Hello,
I have saved data at workspace of scope for three axes. I saved to structure with time. How to plot it to three sublots. Please write code.

Réponses (3)

Albert Yam
Albert Yam le 18 Juil 2012

Ryan
Ryan le 18 Juil 2012
This is not writing all the code for you, but this should hopefully help. Your error seems to be in how to access the information in the structured variable. I am assuming you've saved data to the workspace from a Simulink scope as a structured variable. The first thing you'll want to do is double click on the structured variable in the workspace to open it up in the variable editor and view the path names of interest (if you don't know them already). Just keep clicking through the structures in the variable editor until you get a list of your time points, or output points. Then just reference those paths in a plot command.
Structured elements use a . to denote moving down a structure level so for exmaple:
figure(1),subplot(3,1,1) %In figure 1 access the 1st slot of a 3 x 1 plot space
plot(SimulinkData.Time,SimulinkData.OutputData1)
subplot(3,1,2)
plot(SimulinkData.Time,SimulinkData.OutputData2)
subplot(3,1,3)
plot(SimulinkData.Time,SimulinkData.OutputData3)
As shown in the link Albert provided, there are ways to build more advanced subplots than I have shown, but it's a start.

Paul Costa
Paul Costa le 19 Juil 2012
You should consider using the simplot function.

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by