Vector values replaced by zeros

Hello everyone.
I'm working with a dataset (excel file with columns of different variables, with a lot of values for each of them) and trying to do regressions, but i'm facing a problem : when i run vectors that contain values bigger than 1, then matlab seems to replace all values by zeros. Here is a piece of my code:
"
MMData=dataset('XLSFile', 'DescriptiveStatsCorrectedV4.xlsx');
A=MMData.roa;
B=MMData.assets;
C=MMData.roe;
D=MMData.percfemborrowers;
"
A (roa) and D (percfemborrowers) have only values <1 (in absolute value), so no problems with them.
B (roe) and C (assets) have values >1 (in absolute value), and this is what matlab diplays for them for example :
0.0000
0.0000
0.0000
-0.0000
-0.0000
Could someone help me? Thanks
ps : A weird fact : calculating the mean of one of this vector (ex: for C) still works...

回答 (1 件)

James Tursa
James Tursa 2015 年 3 月 18 日
編集済み: James Tursa 2015 年 3 月 18 日

1 投票

The values in all likelihood are not exact 0's, they just display as 0's to the precision that is printed. To print more digits, e.g.,
format long
or
format long g
Also pay attention to any exponent that appears at the start of the display. E.g.,
>> a = [1 1e-7]
a =
1.0000 0.0000 % a(2) displays as all 0's
>> a(2)
ans =
1.0000e-07 % but a(2) is really the original 1e-7 value
>> a*10000
ans =
1.0e+04 *
1.0000 0.0000
>> format long g
>> a
a =
1 1e-07

2 件のコメント

Dan Pron
Dan Pron 2015 年 3 月 18 日
"long g" seems to work fine!!
Thanks you very much!
Image Analyst
Image Analyst 2015 年 3 月 18 日
Would you mark this as "Accepted" and "Vote" for it to give James "reputation points"?

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeEntering Commands についてさらに検索

質問済み:

2015 年 3 月 18 日

コメント済み:

2015 年 3 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by