Read multiple data from channel to visualizations

3 ビュー (過去 30 日間)
abbbbc
abbbbc 2021 年 2 月 18 日
回答済み: Akanksha 2025 年 3 月 28 日
Hi, does anyone know how to read 3 different data from different channels and plot it using a temperature graph? I am only able to print the x/y axis and legend without any lines. The data I would like to read is only 10 points.
myTimes1 = minutes(length(data1));
myTimes2 = minutes(length(data2));
myTimes3 = minutes(length(data3));
plot(myTimes1,data1, myTimes2,data2, myTimes3, data3);
legend({'Age','Gender', 'Grade'});
xlabel('timestamp');
ylabel('Age+Gender+Grade');
title('whether age&gender affects passing rate');
It turns out like this:
Thanks

回答 (1 件)

Akanksha
Akanksha 2025 年 3 月 28 日
Hey,
To read the data from the 3 different channels and get the correct plot, you can use the following code :
% Example data
data1 = rand(1, 10); % Replace with your actual data
data2 = rand(1, 10);
data3 = rand(1, 10);
% Generate time arrays
myTimes1 = minutes(0:9); % 10 points from 0 to 9 minutes
myTimes2 = minutes(0:9);
myTimes3 = minutes(0:9);
% Plot data
figure;
plot(myTimes1, data1, '-o', myTimes2, data2, '-x', myTimes3, data3, '-s');
legend({'Age', 'Gender', 'Grade'});
xlabel('timestamp');
ylabel('Age+Gender+Grade');
title('whether age&gender affects passing rate');
I have also attached the screenshot of plot I have visualized using above code.
Hope this helps!Thanks.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by