User input for plot axises titles during a script
조회 수: 3 (최근 30일)
이전 댓글 표시
I have written a script which extracts information out of machine readable tables and creates a plot; however, I cannot find a way to allow the user to write in what to call the title and axis' of the plot.
I have attempted to use strings but I cannot find a way to "print" them on the plot. Currently, I have the script writing the labels as xlabel('Modified Julian Date (MJD)'); ylabel('Y-Axis'); title('Automated plot of results over time')
Since the x will always be time.
Does anyone have any suggestions?
댓글 수: 0
답변 (2개)
Honglei Chen
2012년 8월 6일
You can use sprintf
str = 'time';
title(sprintf('Automated plot of results over %s',str));
댓글 수: 0
Jacob
2012년 8월 6일
You can alternatively use input.
title_name=input('Title? ','s')
title(title_name);
You can use this to prompt the user for the figure and axis title.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Title에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!