Automatically changing title based on a function input variables names
Afficher commentaires plus anciens
I made a function that creates a histogram.I want every time i call the function for an input variable 'X' ,the title and the xlabel to change automatically.
For exaple:
- when i i call the function [HISTOGRAM]=hist(apples),then my title should be 'HISTOGRAM apples'
- when i i call the function [HISTOGRAM]=hist(lemons),then my title should be 'HISTOGRAM lemons
The same for xlabel.
Is this possible?
below is the code i have already written.
function [HISTOGRAM]=hist(X)
HISTOGRAM=histogram(X)
title('HISTOGRAM (VARIABLE NAME)')
xlabel('(VARIABLE NAME)')
ylabel('Number of sequence reads')
end
1 commentaire
dpb
le 30 Avr 2022
Look at
doc inputname
and see if that gives you any ideas...
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Grid Lines, Tick Values, and Labels dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
