Simulink: Create line object - Matrix vs. vector input

Why is there a difference between
figure;
process = {'process' , [0.2500 0.5000], [0.6 0.8];
'process2', [0.1250 0.2500], [0.2 0.6];
'process3', [0.3125 0.2500], [0.4 0.6];
'process4', [0.2500 0.3125], [0.2 0.4];
'process5', [0.3750 0.3125], [0.2 0.4];
'process5', [0.5625 0.5000], [0.6 0.8];};
L=line(cell2mat(process(:,2)), cell2mat(process(:,3)));
and
figure;
process = {'process' , [0.2500 0.5000], [0.6 0.8];
'process2', [0.1250 0.2500], [0.2 0.6];
'process3', [0.3125 0.2500], [0.4 0.6];
'process4', [0.2500 0.3125], [0.2 0.4];
'process5', [0.3750 0.3125], [0.2 0.4];
'process5', [0.5625 0.5000], [0.6 0.8];};
hold on
L=line(cell2mat(process(1,2)), cell2mat(process(1,3)));
L=line(cell2mat(process(2,2)), cell2mat(process(2,3)));
L=line(cell2mat(process(3,2)), cell2mat(process(3,3)));
L=line(cell2mat(process(4,2)), cell2mat(process(4,3)));
L=line(cell2mat(process(5,2)), cell2mat(process(5,3)));
L=line(cell2mat(process(6,2)), cell2mat(process(6,3)));
?
Is there a way that enables me to use the first version (= using the line function only once) with the result of the second one?

 Respuesta aceptada

The solution is simply to use
L=line(cell2mat(process(:,2))', cell2mat(process(:,3))');
instead of
L=line(cell2mat(process(:,2)), cell2mat(process(:,3)));

Más respuestas (0)

Categorías

Más información sobre Simulink Functions en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 30 de Mzo. de 2016

Respondida:

el 31 de Mzo. de 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by