MATLAB PLOT Legend, dynamic additional content

xiaoxiao2021-03-06  56

It seems that Matlab's Legend does not "apise" this option, that is, each call will regenerate Legend, all over the front. There are also methods of string matrices, but unfortunately, every line is not too long. I think a way to speculate is to achieve addition.

There are several curves that have been saved in curve_obj {}.

The name of each curve is saved in Curve_Name {}

So the way to generate a string, gentleman is a Legend_Command

Then use the eval () function to call this generated command.

Legend_command = ['legend (curve_obj,' ', curve_name {1},' '');

For i = 2: curve_used_count% Construct the Command The Display a Legend

Legend_command = [legend_command, ',' ', curve_name {i},' ​​'' '];

end

Legend_command = [legend_command, ')']

evAl (Legend_Command);

In fact, this method is also clumsy, hoping to have a better solution, such as the operation of the input character matrix.

转载请注明原文地址:https://www.9cbs.com/read-72070.html

New Post(0)