how legend update with variable

t=linspace(0.1,1,10)
legend ('0.1','0.2','0.3',......upto '1')
how legend update with variable 't' with there values on graph

댓글 수: 4

You mean like this?
t=linspace(0.1,1,10);
legend_txt=cellfun(@(x)sprintf('%.1f',x),num2cell(t),'UniformOutput',0);
legend(legend_txt)
If that is not what you're looking for, please expand you question. Have a read here and here. It will greatly improve your chances of getting an answer.
Sun Heat
Sun Heat 2019년 8월 23일
thanks a lot
Bruno Luong
Bruno Luong 2019년 8월 23일
편집: Bruno Luong 2019년 8월 23일
There is something called ARRAYFUN
legend_txt = arrayfun(@(x)sprintf('%.1f',x),t,'UniformOutput',0)
Sun Heat
Sun Heat 2019년 8월 26일
thanks

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

질문:

2019년 8월 23일

댓글:

2019년 8월 26일

Community Treasure Hunt

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

Start Hunting!

Translated by