フィルターのクリア

Plot data according to different ID

4 ビュー (過去 30 日間)
Soso
Soso 2021 年 3 月 9 日
コメント済み: Soso 2021 年 3 月 9 日
Hi
I have csv file that have 3 culomns, first is IDs, second is date/time and third is the actual data. The data includs measrments that occured at specific date/time for each ID, so that all measurments are displayed for eah ID one by one. I need to plot the data per ID and I need help on how to ask MATLAB to call data that belong to each ID and subplot them.
  2 件のコメント
Nora Khaled
Nora Khaled 2021 年 3 月 9 日
can you please give us a sample data to work with?
also, you mean that you want to plot measurement vs time/date for each ID, right ?
Rik
Rik 2021 年 3 月 9 日
What did you try so far? Did you already Google how to read a csv file?

サインインしてコメントする。

採用された回答

Nora Khaled
Nora Khaled 2021 年 3 月 9 日
This might work
t = readtable('samle_data.xlsx');
% devide table into groups using ID
G = findgroups(t(:,1));
dataByID = splitapply( @(varargin) varargin, t, G);
%use dataByID to plot
[nID,~]=size(dataByID); % number of different IDs
figure;
hold on;
for i=1:1:nID
plot(dataByID{i,2},dataByID{i,3});
end
xlabel('time/date');
ylabel('measurements');
  1 件のコメント
Soso
Soso 2021 年 3 月 9 日
Thank you very much for your help

サインインしてコメントする。

その他の回答 (2 件)

Soso
Soso 2021 年 3 月 9 日
Yes I want to plot measurement vs time/date for each ID.
Thanks

Soso
Soso 2021 年 3 月 9 日
Yes, I know how to upload the file, I just need to know how I could call the data per ID and plot it over time.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by