How to name axes from the script

5 vues (au cours des 30 derniers jours)
okoth ochola
okoth ochola le 23 Jan 2023
Modifié(e) : Askic V le 23 Jan 2023
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.

Réponse acceptée

Askic V
Askic V le 23 Jan 2023
Modifié(e) : Askic V le 23 Jan 2023
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)

Plus de réponses (1)

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

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by