0
votes

how to read the following .dat file in matlab?

i have already tried read.table and textscan, but those option doesn't seem to work.

the file contains
column1=ID 
column2=longitude
column3=latitude
column4=country
column5=city

for more than 1000 rows.

The problem is also that after reading, i should be able to display the places with the longitude,latitude on a map.

1
"but those option doesn't seem to work" doesn't help us. Edit your question to show the specific code you used and any errors in full, etc. Also show example data from your file (or a link to it) so that we can try to replicate. Lastly, the bit about displaying your data on a map makes this too broad (you also don't show what you've tried for that). Edit your question to cut that. - horchler
PLease read the posting guidelines and post a small reproducible sample of your data. - Carl Witthoft

1 Answers

0
votes

Something like this should works. textscan strongly depends of the type in each column.

fid=fopen(your_file,'r');
c = textscan(fid,'%s %f %f %s %s');
fclose(fid);
results = [c{1} c{2} c{3} c{4} c{5}];

%s is for string, %f is for float