how can I add a legend in a scope block?
thanks
Pietro
However, since a scope is just a MATLAB figure window in disguise you can with a little bit of careful effort use standard Handle Graphics, along the lines of
% get handles to all scopes (the scope must have been opened at least once for this to work)
>> hScopes = findall(0,'Tag','SIMULINK_SIMSCOPE_FIGURE');
% Assume we want to put a legend on the first scope
% Get the axes on the scope
>> hAxes = findall(h(1),'Type','axes');
% Assume we want to put a legend on the first axis on the scope, and that
% it has 3 signals on it.
>> legend(hAxes(1),{'signal1','signal2','signal3'},'Color',[1 1 1]);
Note that the legend will not update or do anything else automatically if you change the signals going into the scope.
Phil.