Why are title and label not working on histogram?

30 ビュー (過去 30 日間)
belowaveragestudent
belowaveragestudent 2022 年 5 月 5 日
I have two subplots, both containing histograms but I can't add a title or labels to both of them.
Matlab tells me, that the value assigned to "title", "xlabel" and "ylabel" might be unused.
But I do want to use them.
This is my code so far:
subplot(1,2,1);
histogram(measurement1, 'BinEdges', [10:10:120], 'Normalization', 'probability');
title = ('Temperatures @ Top')
xlabel = ('Temperature')
ylabel = ('Probability')
subplot(1,2,2);
histogram(measurement2, 'BinEdges', [10:10:120], 'Normalization', 'probability');
title = ('Temperatures @ Bottom')
xlabel = ('Temperature')
ylabel = ('Probability')
Any help appreciated

採用された回答

Constantino Carlos Reyes-Aldasoro
Constantino Carlos Reyes-Aldasoro 2022 年 5 月 5 日
You are using the commands incorrectly, by writing title = ('Temperatures @ Top') you are creating a new variable called title with the values that you pass, the correct sintax is the following
measurement1 = 100*randn(100,1);
subplot(1,2,1);
histogram(measurement1, 'BinEdges', [10:10:120], 'Normalization', 'probability');
title ('Temperatures @ Top')
xlabel ('Temperature')
ylabel ('Probability')
Hope that solves your problem

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTitle についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by