matlab online how to reference file in folder at same directory

12 views (last 30 days)
Hi,
I'm using Matlab online. In my Matlab drive i have a folder in the same directory that my main.m . The folder is callded "Test2" and inside is a csv file, named 'testeXPTO.csv'. My code in main.m is this:
fid=fopen('../Test2/testeXPTO.csv');
C = textscan(fid, '%s','delimiter', '\n');
The error is:
Error using textscan Invalid file identifier. Use fopen to generate a valid file identifier.
What is the code to relative reference a path of a file that is inside a folder in the same directory that my main.m in Matlab online.
Thanks Your Francisco
  2 Comments
Stephen23
Stephen23 on 9 Jun 2017
Edited: Stephen23 on 9 Jun 2017
Please show us both the fid and msg values:
[fid,msg] = fopen('../Test2/testeXPTO.csv')
Francisco Correia
Francisco Correia on 9 Jun 2017
Now it's working. Sorry but, i swear than earlier today i got the error that i show above. But now even when i use:
fid=fopen('../Test2/testeXPTO.csv');
it's OK. Thanks.

Sign in to comment.

Accepted Answer

Francisco Correia
Francisco Correia on 9 Jun 2017
[fid,msg] = fopen('../Test2/testeXPTO.csv')

More Answers (0)

Communities

More Answers in the  Distance Learning Community

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!