- #1

dRic2

Gold Member

- 755

- 182

10 -2.34454

12 -2.34566

14 -2.34677

... ...

and I want to store the data in two variables: the first is the "counting" (10, 12, ...) and the second is the value (-2.34454, ...). So I wrote the following script, but I run in the following problem

Code:

```
function [out1, out2] = read(fid)
i = 1;
while true
currentline = fgetl(fid);
if (currentline == -1)
break;
end
pos = find(currentline == ' ');
for j=1:pos
count(j) = currentline(j);
end
for j=(pos+1):(length(currentline))
value(j) = currentline(j);
end
count_num(i) = str2num(count); % <--------- THIS WORKS
value_num(i) = str2double(value); % <-------- THIS DOES NOT WORK !!!!!
i++;
end
out1 = count_num;
out2 = value_num;
end
```

Any help would be highly appreciated.

Ric