How to access variable imported using import data tool?

10 vues (au cours des 30 derniers jours)
Georgie Taylor
Georgie Taylor le 18 Jan 2016
Modifié(e) : Stephen23 le 18 Jan 2016
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 commentaire
Stephen23
Stephen23 le 18 Jan 2016
Modifié(e) : Stephen23 le 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.

Connectez-vous pour commenter.

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by