Read multiple data from channel to visualizations
Show older comments
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
Answers (1)
Akanksha
on 28 Mar 2025
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.
Categories
Find more on Software Development in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!