Converting Table to Readable Format for Scatter Plot

15 visualizaciones (últimos 30 días)
David Forgy
David Forgy el 14 de Oct. de 2022
Respondida: VBBV el 6 de Nov. de 2022
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});

Respuestas (2)

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

Iniciar sesión para comentar.


VBBV
VBBV el 6 de Nov. de 2022
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

Categorías

Más información sobre Logical en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by