matlab online how to reference file in folder at same directory

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

Please show us both the fid and msg values:
[fid,msg] = fopen('../Test2/testeXPTO.csv')
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

More Answers (0)

Communities

More Answers in the  Distance Learning Community

Categories

Products

Community Treasure Hunt

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

Start Hunting!