I want to add some information in the top x axis

3 ビュー (過去 30 日間)
Odd-Simon Simonsen
Odd-Simon Simonsen 2023 年 3 月 16 日
回答済み: Sanjana 2023 年 3 月 30 日
I have a code that plots the temperature from 4 different sensors, and the x axis shows the logging number, the y axis shows the temperature.
This is my code:
plot(dat00001m.Var3,'DisplayName','dat00001m.Var3');
hold on;
plot(dat00001m.Var4,'DisplayName','dat00001m.Var4');
plot(dat00001m.Var5,'DisplayName','dat00001m.Var5');
plot(dat00001m.Var6,'DisplayName','dat00001m.Var6');
ylabel('Temperatur [℃]');
xlabel('Log#');
legend({'chan101', 'chan102', 'chan103', 'chan104'}, 'Location', 'northeast');
hold off;
output:
But, I want to add another x label on top of the plot that shows the real dime the sensor logged the information. This is saved in my table as 'dat0001m.Var2'.
I want this to log on the same pharameters that are set for the log, so value 0, 500, 1000, 1500, 2000, 2500.
How can i do this? Thank you!

回答 (1 件)

Sanjana
Sanjana 2023 年 3 月 30 日
Hi,
I understand that you are looking for ways to label the x-axis using the data in "dat0001m.Var2".
To accomplish this, you can utilize the "xticklabels" function. This function allows you to pass a string array containing the data from "dat0001m.Var2" file as labels for the x-axis.
Please refer to the below link for further help,
Hope this helps!

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by