how can import data excel to scope in simulink? (plot charts)
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
0.047418 0.485851
0.111818 0.581864
0.07743 0.526557
0.185357 0.675541
0.159962 0.623343
0.820219 0.724674
1.728073 0.731636
2.635927 0.742078
3.543781 0.753874
4.451635 0.766057
0 comentarios
Respuestas (1)
Udit06
el 30 de Ag. de 2024
Hi,
You can follow the steps below to visualize Excel sheet data in Scope block in Simulink:
1) Load the excel sheet in form of a table in MATLAB workspace. You can refer to the following MathWorks documentation to understand more about how to load Excel sheet data in the workspace:
2) Since you want to plot two variables let us say a and b, you can create a time vector which can be used as a common time reference for both the variables.
%Book2 is the name of the table
% Create a time vector from 1 to 10
time = 1:1:10;
% Assign data from Book2.VarName1 to variable a
a = Book2.VarName1;
% Assign data from Book2.VarName2 to variable b
b = Book2.VarName2;
% Concatenate the time vector with a to form a 10-by-2 matrix
a = [time' a];
% Concatenate the time vector with b to form another 10-by-2 matrix
b = [time' b];
3) You can use Simulink's From Workspace block to input data from workspace into Simulink. Connect the output of the From Workspace blocks to the input of the Scope block as shown below:
4) Simulate the model and view the output of the Scope block. For the data that I have used, the output is shown below:
I hope this helps.
0 comentarios
Ver también
Categorías
Más información sobre Data Import from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!