How to access variable imported using import data tool?

14 views (last 30 days)
Sorry in advance for any poor use of terminology, I'm a bit rusty.
I'm trying to read a 4-column .dat file with double spaced delimiters and header and footer lines that need to be excluded, so used the import data button. I selected the data range and delimiters I wanted, and used column vectors to store the data.
After clicking import selection, I can double click on the 'w' variable in the workspace, and all of the data is correctly stored.
However, when I try print w in the command window
if true
% w
end
I get values that are mostly 0.0000 entries, with a few (inaccurate) numbers present. I won't post the whole output as the data set is quite large, but the smallest value in w should be 50, so the following output indicates to me something is going wrong somewhere. Help?
>> testcode
w =
1.0e+08 *
6.0000
2.0000
0.1200
0.0100
0.0060
0.0025
0.0012
0.0005
0.0005
0.0005
0.0005
0.0005
0.0004
0.0004
0.0004
0.0004
0.0004
0.0004
0.0004
0.0004
0.0004
  1 Comment
Stephen23
Stephen23 on 18 Jan 2016
Edited: Stephen23 on 18 Jan 2016
There is nothing wrong with your data, the values are not "inaccurate", they are simply displayed with a common multiplier at the beginning:
w =
1.0e+08 * <- this is a factor of all displayed values below!
6.0000
2.0000
0.1200
0.0100
...
MATLAB uses one factor to allow the displaying of numbers with many different magnitudes, without cluttering up the screen with lots of exponents.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 18 Jan 2016
Give the command
format long g
and look at the data again.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!