poster
2019-11-25, 18:02
<p>I have three structures 1x103 : Steps, Time and Loc. All 3 have 2 fields (contr and prost, each line is a 30x1 double)</p>
<p>I would like to plot theses structure without for loops like : </p>
<pre><code>figure
plot(Time.Contr, Steps.Contr),
hold on, plot(Time.Contr, Loc.Contr)
</code></pre>
<p>But I get an error : "Vectors must be the same length."</p>
<p>I tried <code>plot(Time(:).Contr, Steps(:).Contr)</code> and got the same error
I thought about using "<code>cellfun</code>" but I don't have cell arrays but double arrays</p>
<p>Is there any other solution than using a for loop ?</p>
More answer... (https://stackoverflow.com/questions/59028953/how-plot-structures-whithout-for-loop)
<p>I would like to plot theses structure without for loops like : </p>
<pre><code>figure
plot(Time.Contr, Steps.Contr),
hold on, plot(Time.Contr, Loc.Contr)
</code></pre>
<p>But I get an error : "Vectors must be the same length."</p>
<p>I tried <code>plot(Time(:).Contr, Steps(:).Contr)</code> and got the same error
I thought about using "<code>cellfun</code>" but I don't have cell arrays but double arrays</p>
<p>Is there any other solution than using a for loop ?</p>
More answer... (https://stackoverflow.com/questions/59028953/how-plot-structures-whithout-for-loop)