array of plots in simulink

3 visualizaciones (últimos 30 días)
Wesley Ooms
Wesley Ooms el 5 de Dic. de 2011
Hello,
I wrote the following embedded matlab function to plot an array of scopes:
function fcn(t,u)
% This block supports an embeddable subset of the MATLAB language.
% See the help menu for details.
figure(1)
subplot(331);
h=findobj(gca,'Type','line');
if isempty(h);
plot(t,u)
else
set(h,'XData',[get(h,'XData') t],'YData',[get(h,'YData') u]);
drawnow
end
I get the following error:
Embedded MATLAB Interface Error: Size mismatch for MATLAB expression 'get'. Expected = 1x1 Actual = 1x2
Block Embedded MATLAB Function (#44)
While executing: none.
Does anyone know what goes wrong and how i can solve it?
thanks,
edit: seems that I'm not allowed to use the get command. is there another way to get the X and Y data?
edit2: I solved the problem using the XY graph from the submenu sinks. --> drop in the simulink model --> look under mask --> open the sfun dialog box --> edit the sfun --> search in the sfun for the word axes, and replace that word by subplot(331). done
  3 comentarios
Fangjun Jiang
Fangjun Jiang el 6 de Dic. de 2011
I am curious about the use case. It sounds odd to me to use the above code to generate the plot in Simulink. Why can't you use the Scope block?
Wesley Ooms
Wesley Ooms el 24 de Abr. de 2013
@Fangjun Jiang. Sorry for the late reply.
The use case is that 9 figures in a column are not readable, while in a 3x3 matrix, they are.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Naming Conventions 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!

Translated by