How do import data?

6 views (last 30 days)
Maria De Silva
Maria De Silva on 16 Apr 2016
Answered: Azzi Abdelmalek on 16 Apr 2016
For this part I have to get data from the first row. Which I know you use fgetl. But what if my data has 4 columns and 5 rows. And I want to get data from the first column. How do I do that?
if true
% filename='lab4_data.txt';
fid=fopen(filename,'r'); %opening read only
temperature=fgetl(fid);
temperature=str2num(temperature);
fclose(fid);code
end

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 16 Apr 2016
[a,~,~,~]=textread('file.txt')

More Answers (0)

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!