Unable to open file 'Diabetes.csv'.

2 ビュー (過去 30 日間)
Madiha Rehman
Madiha Rehman 2022 年 1 月 18 日
編集済み: Adam Danz 2022 年 1 月 18 日
I'm new to matlab I'm having trouble with this one. Where should I put my excel file so MATLAB can read it?
Code:
%Read data
clc
clear all
close all
data=readtable ('Diabetes.csv');
Error:
Error using readtable (line 143)
Unable to open file 'Diabetes.csv'.
  1 件のコメント
Star Strider
Star Strider 2022 年 1 月 18 日
Be sure it’s on the MATLAB search path somewhere so that MATLAB can find it.
For help on that see What Is the MATLAB Search Path?.

サインインしてコメントする。

回答 (1 件)

Adam Danz
Adam Danz 2022 年 1 月 18 日
編集済み: Adam Danz 2022 年 1 月 18 日
To add to @Star Strider's advice, you can put the file anywhere you want as long as it's folder is on the Matlab path. For example, if the file is in C:\Users\name\Documents\Matlab\data then add the path using
addpath('C:\Users\name\Documents\Matlab\data')
Now Matlab will be able to access the file.
Alternatively, you can specify the full path to the file so Matlab knows where it's at even if it's not on the Matlab path,
filepath = 'C:\Users\name\Documents\Matlab\data';
filename = 'Diabetes.csv';
data = readtable(fullfile(filepath, filename));

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

製品


リリース

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by