Add legend labels to array of smith plots - error "Unable to perform assignment..."
21 次查看(过去 30 天)
显示 更早的评论
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?)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1082195/image.png)
with the following error after the first assignment:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1082200/image.png)
Now, I have also tried assigning the three labels without indexing. Interestignly, I get the same error, HOWEVER, the legend labels are successfully assigned!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1082205/image.png)
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 个评论
Adam Danz
2022-7-29
It would be easier to troubleshoot if we could reproduce these results. You would need to provide the input data and relevant code.
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Pie Charts 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!