Add legend labels to array of smith plots - error "Unable to perform assignment..."
19 views (last 30 days)
Show older comments
I am facing this weird issue with smithplot when trying to assign individual legend labels from a cell array.
My legends look like this:
smith_legends = {'S11 reflection','S21 shunt','S21 series'};
I am creating a set of 3 superimposed smith charts in a loop where an array of handles is created. As an example:
for idx = 1:3
smith_handles(idx) = smithplot(freq, Sxx, 1,1, 'GridType','Z');
% smith_handles(idx).LegendLabels = smith_legends(idx); % --> line that fails
hold on
end
where freq and Sxx are my data pairs (Sxx is a complex matrix)
When assigning the labels, I get this: (why there are more legends than datasets?! why the colors don't match?)
with the following error after the first assignment:
Now, I have also tried assigning the three labels without indexing. Interestignly, I get the same error, HOWEVER, the legend labels are successfully assigned!
Why Matlab insists with throwing this error: "Unable to perform assignment with 0 elements on the right-hand side."
Why "0 elements"?! if the labels are there!
2 Comments
Adam Danz
on 29 Jul 2022
It would be easier to troubleshoot if we could reproduce these results. You would need to provide the input data and relevant code.
Answers (1)
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!