A numeric or double convertible argument is expected- How to plot from 'readtable'
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Dear scholars,
I have a dataset of numbers in Excel as .csv file which is attached. I need to plot the first coulumn as the 'x' values and the third column values as the 'y' values. Apparently there is a problem with the 3rd column and MATLAB get's this column as string (not numeric values). Any suggestions? The Excel and the code are both attached.
Thanks in advacne!
clc
clear all
close all
C = readtable('e1.csv')
t = C(:,1)
v1 = C(:,3)
%v = [12.5, 16.17, 18.79, 13.59, 12.58, 12.46, 12.67, 12.5, 12.73, 13.36, 12.56, 12.6, 12.62, 12.98, 13.87, 13.82, 13.71, 13.78, 14.27];
numel(v)
numel(t)
plot(t, v)
0 commentaires
Réponses (1)
Cris LaPierre
le 11 Fév 2021
Modifié(e) : Cris LaPierre
le 11 Fév 2021
See this page on how to access data in a table. Your syntax is returning a table. You need an array.
Use curly braces
t = C{:,1}
v = C{:,3}
or dot notation
t = C.(1)
v = C.(3)
0 commentaires
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!