Why Import data still does not work with CSV files in R2022a ?

8 Ansichten (letzte 30 Tage)
Pieter Jonker
Pieter Jonker am 31 Mär. 2022
Kommentiert: Walter Roberson am 25 Jun. 2025
Import CSV files did work in Matlab R2022a. But only once!
After that I got "The import tool does not have acces to read the file"
A very old bug still not solved?

Antworten (2)

Srijith Kasaragod
Srijith Kasaragod am 4 Apr. 2022
I understand that MATLAB throws the error "The import tool does not have access to read the file" when you are trying to import CSV files using the Import tool.
Please try to restore the default path and rehash the toolbox cache by running the following commands and restarting MATLAB:
>>restoredefaultpath
>>rehash toolboxcache
If the issue persists, try the following workarounds:
1) Check whether there are files such as an "h.m" in the current directory. Try importing the file from an otherwise empty directory.
2) You can call the function "load" which can store the file as an array:
>> variable = load(filename)
3) You can also use the function "csvread" to load/import data. However, note that this will not work for empty CSV files.
>> variable = csvread(filename)
Regards,
Srijith.
  1 Kommentar
Sudipta Ray
Sudipta Ray am 16 Jun. 2023
Worked like a charm with the restoring and rehashing steps. Thank you, Srijith!

Melden Sie sich an, um zu kommentieren.


Duncan Carlsmith
Duncan Carlsmith am 25 Jun. 2025
I ran into this today and the suggested fixes didn't work. The problem was I had a '*' in an enclosing folder name.
  3 Kommentare
Duncan Carlsmith
Duncan Carlsmith am 25 Jun. 2025
MacOS allows an asterix in a folder name, and spaces and other things, and my folder concerns SagA*, the black hole in the center of the Milky Way, hence the *. Interestingly, I added the folder to my path just fine but that didn't help. Even within the folder, I could not access a file without an asterix in the name using the Import Data Tool, tried rebooting, the resetpath thing, different MATLAB versions. Somehow in that tool's path search, the tool doesn't start searching the local path first or something and hits something like a UNIX wildcard interpretation or MATLAB limitation.
Walter Roberson
Walter Roberson am 25 Jun. 2025
MacOS and Linux permit wildcard characters in folder names.
mkdir('test*junk')
dinfo = dir('test*')
dinfo = struct with fields:
name: 'test*junk' folder: '/users/mss.system.zrfmb' date: '25-Jun-2025 20:47:39' bytes: 0 isdir: 1 datenum: 7.3979e+05
{dinfo.name}
ans = 1×1 cell array
{'test*junk'}

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by