我在 Simulink 中有一个带有多路复用器块 Mux 的 Scope(我想在一个图中绘制多个波形)。模拟后,我需要以定义的形式(背景颜色、线条宽度等)将其导出为 eps/pdf 和 png 文件。
实际问题:
- 图例中的颜色不正确。
我的梦想:
- 在 Simulink 中开始仿真(点击 F5 开始)
- 然后调用我自己的函数(脚本)来导出它(例如set_and_export(label x, label y, legend wave 1, legend wave 2, .. ,legend wave x))
最后的状态是实现我的梦想。
我的 m 文件:
% Get the data from Simulink
% First column is the time signal
% in Scope in Simulink : Array with time
[nothing, NumOfSgns] = size(ScopeData)
time = ScopeData(:,1);
% Plot all signals
hold on
for j=0:NumOfSgns-2,
graph=plot(time,ScopeData(:,2+j:end),'Color', rand(1,3));
% Signals description and position of the legend
legend('firs wave form','next wave form','Location','SouthEast');
end
hold off
谢谢你。