フィルターのクリア

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

2 ビュー (過去 30 日間)
Alireza Babaei
Alireza Babaei 2021 年 2 月 11 日
編集済み: Cris LaPierre 2021 年 2 月 11 日
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 Center および File ExchangeSpreadsheets についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by