필터 지우기
필터 지우기

A numeric or double convertible argument is expected- How to plot from 'readtable'

조회 수: 2 (최근 30일)
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)

답변 (1개)

Cris LaPierre
Cris LaPierre 2021년 2월 11일
편집: Cris LaPierre 2021년 2월 11일
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)

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by