So I am trying to get a textfile onto matlab and define a matrix. I copied and pasted it onto the current folder in the name window next to the command window. In the command I put A=dlmread('file') but it keeps on giving me a cannot find file.

4 views (last 30 days)
A=dlmread('file') Error using dlmread (line 62) The file 'channel_AVG_Gly_3.5ul_min_particlt_.5ul_min_01.txt' could not be opened because: No such file or directory

Answers (1)

Marc Jakobi
Marc Jakobi on 10 Oct 2016
Edited: Marc Jakobi on 10 Oct 2016
Try this:
pathname = 'path\to\file'; %path to the file
filename = 'file.txt'; %don't forget the file extension (.txt)
A = dlmread(fullfile(pathname,filename));
or
pathname = pwd;
filename = 'file.txt';
A = dlmread(fullfile(pathname,filename));

Categories

Find more on Data Import and Analysis in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!