getting user input in title and legend

조회 수: 4 (최근 30일)
mat geek
mat geek 2019년 4월 22일
답변: Adam Danz 2019년 4월 22일
the code is you want to create a graph showing the relationship of an ideal gas between pressure (P) and temperature (T).
the first 2 are Nitrogen, and oxygen the third will be ser input of gas. I created 2 figures. Figure (1) for all plots on the same axis, and the figure 2 is for sublpot of each gas.And ask the user to input the gas name. But how can I input the gas name from the user to the legend or title.
I hope that was clear.

답변 (2개)

Star Strider
Star Strider 2019년 4월 22일
I would use the inputdlg (link) function. You can also use input.
  댓글 수: 3
Star Strider
Star Strider 2019년 4월 22일
mat geek’s Answer moved here:
How can You do that and place it in title or legend?
Star Strider
Star Strider 2019년 4월 22일
Use that to get the user input.
Then use the sprintf function to print it in the title or legend.

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


Adam Danz
Adam Danz 2019년 4월 22일
In addition to Star Strider's method, the user can directly edit titles and legend strings by selecting them on the figure itself (the user won't be prompted and will have to know how to edit these objects).
Just click on the white arrow, then double-click the title and/or legend to change the string.
190422 174146-Figure 1.jpg

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by