Converting Table to Readable Format for Scatter Plot

24 次查看(过去 30 天)
Hi!
It's been a while since I've last used MatLab so I apologize in advance if I use maybe some wrong terminology or if this has been solved and I just couldn't find it on my searches.
The issue I'm coming into is I had to import data from a text file, which has its own very weird format into a useable ScatterPlot Graph.
I used the import function from Excel with Tab Delimiter, saved it as an .xlsx file, then uploaded that data into matlab via readtable(), and then transposed the data.
The problem I'm running into is how to use the Top Row as my X variable, which is currently timestamped in '4:08:45 PM' and increases in 5 second intervals ('4:08:50 PM', '4:08:55 PM', etc). Then take the selected rows as needed for the Y-Data. (Voltage, Current, Power, repeating).
I know I'm forgetting or doing something wrong, but have hit a dead end on searches. The error currently getting output is "Input arguments must be numeric, datetime, duration or categorical." I've tried several different things, and I'm not sure what course would be the best line of action to take.
T1 = readtable('Data.xlsx');
T1_Data = table2array(T1);
T1_Data = T1_Data';
T1_Data = cell2table(T1_Data);
scatter(T1_Data{:,1}, T1_Data{:,3});

回答(2 个)

KSSV
KSSV 2022-10-14
T1 = readtable('Data.xlsx');
scatter(T1.(1), T1.(3));
  1 个评论
David Forgy
David Forgy 2022-10-14
Unforuntely this gives me the same error.
Also, the table really does need to be transposed. Before the Transpose the format given looks like:

请先登录,再进行评论。


VBBV
VBBV 2022-11-6
T1 = readtable('Data.xlsx');
T1_Data = table2array(T1); % this converts cell to numeric
T1_Data = T1_Data';
% T1_Data = cell2table(T1_Data); % this converts numeric to cell
scatter(T1_Data(:,1), T1_Data(:,3));
Use numeric data for scatter plot

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by