How to access variable imported using import data tool?

조회 수: 6 (최근 30일)
Georgie Taylor
Georgie Taylor 2016년 1월 18일
편집: Stephen23 2016년 1월 18일
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
Stephen23
Stephen23 2016년 1월 18일
편집: Stephen23 2016년 1월 18일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2016년 1월 18일
Give the command
format long g
and look at the data again.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by