How to name axes from the script

4 ビュー (過去 30 日間)
okoth ochola
okoth ochola 2023 年 1 月 23 日
編集済み: Askic V 2023 年 1 月 23 日
Hi community, Ihave a slight problem. I have written a program which include plotting of graph. Now i want the program to prompt me to input desired axes titles when the program is executed/run. Can somebody asist.

採用された回答

Askic V
Askic V 2023 年 1 月 23 日
編集済み: Askic V 2023 年 1 月 23 日
I would do ike this:
x = linspace(0, 50);
y = sin(x);
plot(x,y);
input_x = input('Enter name for x label:','s');
input_y = input('Enter name for y label:','s');
xlabel(input_x)
ylabel(input_y)

その他の回答 (1 件)

KSSV
KSSV 2023 年 1 月 23 日
plot(rand(1,10))
labelx = input('Input Xlabel:') ;
labely = input('Input Ylabel:') ;
xlabel(labelx)
ylabel(labely)

カテゴリ

Help Center および File ExchangeGraphics Object Programming についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by