- https://www.mathworks.com/matlabcentral/answers/453940
- https://www.mathworks.com/help/simulink/slref/toworkspace.html
How to use simulink output in matlab for graphs?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I've been trying to use MATLAB and the "To Workspace" block in SIMULINK to call some data to be used in some plots but i'm just getting errors that MATLAB is "Unable to resolve the name 'out.____'" no matter what i've tried. Below is the code and attached are all the files.
I wanted to automate it using a loop but that just gave me more trouble so I resorted to just going line by line.
% Constants
%% For Evans Blue
Vpls = 3.5; % Blood Plasma Vol (L)
%% For Inulin
Vecf = 14; % Extracellular Fluid Vol (L)
kIu = 1.4; % Loss of Inulin (L/min)
%% For Antipyrine
Vtbf = 42; % Total body fluid Vol (L)
kAu = 2.1; % Loss of AP by excretion (L/min)
kAm = 0.84; % Loss of AP by metabolism (L/min)
Select = 1;
figure % Evans Blue Graphs
Select = 1; % Setting for Continuous
subplot(2,1,1)
sim('Lab3EB.slx');
plot(out.Eout)
xlabel('Time (min)')
ylabel('Concentration (mg/L)')
title('Evans Blue Continuous')
clear out
Select = -1;% Setting for Bolus
sim('Lab3EB.slx');
subplot(2,1,2)
plot(out.Eout)
xlabel('Time (min)')
ylabel('Concentration (mg/L)')
title('Evans Blue Bolus')
figure % Inulin Graphs
Select = 1; % Setting for Continuous
subplot(2,1,1)
sim('Lab3In.slx');
plot(out.Iout)
xlabel('Time (min)')
ylabel('Concentration (mg/L)')
title('Inulin Continuous')
Select = -1; % Setting for Bolus
subplot(2,1,2)
sim('Lab3In.slx');
plot(out.Iout)
xlabel('Time (min)')
ylabel('Concentration (mg/L)')
title('Inulin Bolus')
Select = 1;
Select = 1; % Setting for Continuous
subplot(2,1,1)
sim('Lab3AP.slx');
plot(out.Aout)
xlabel('Time (min)')
ylabel('Concentration (mg/L)')
title('Antipyrene Continuous')
Select = -1; % Setting for Bolus
subplot(2,1,2)
sim('Lab3AP.slx');
plot(out.Aout)
xlabel('Time (min)')
ylabel('Concentration (mg/L)')
title('Antipyrene Bolus')
0 commentaires
Réponses (1)
Abhinav Aravindan
le 18 Oct 2024
Modifié(e) : Abhinav Aravindan
le 18 Oct 2024
Hi Brooke,
The simulation outputs of the “To Workspace” block is returned as a SimulationOutput object when “Single simulation output” parameter is enabled in “Configuration Parameters” and not in the “Out” variable which is causing the error. You can access the simulation outputs as follows:
simout = sim('Lab3EB.slx');
plot(simout.Eout)
Please refer to the following link and documentation for further detail:
From the code, it appears that the “Select” variable is being changed and the plots are generated. To simplify this operation, you may utilize “Variant Parameters” to reuse block parameters with different values. For more detail on using “Variant Parameters”, you may refer to the documentation below.
0 commentaires
Voir également
Catégories
En savoir plus sur Programmatic Model Editing 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!