A Ghost Data In Matlab???

5 ビュー (過去 30 日間)
Tyann Hardyn
Tyann Hardyn 2022 年 2 月 10 日
コメント済み: Walter Roberson 2022 年 2 月 10 日
Hi, Community
I just found a very very awkward data in matlab, especially when i pointing a variable data (from table data) which is shown as a normal double data when i debug it. BUT when i evaluate the variable data, it become significanly different. Here is the issue :
I cant understand why the 2015 Double data become 0.2015 when i evaluate it. Its works as normal with a same other data.
Its sooo Impossible... I just re try it and its still not works... How i can fix it? Would anyone lend me a hand to explain and solve this Ghost Data? Thanks
  3 件のコメント
Rik
Rik 2022 年 2 月 10 日
@Andres, you should expand your comment a bit (explaining the difference between data and the display of that data) and post it as an answer.
Tyann Hardyn
Tyann Hardyn 2022 年 2 月 10 日
編集済み: Tyann Hardyn 2022 年 2 月 10 日
I actually use this code for reading the data :
T_raww = readtable(full,opt_rwks);
T_raww2 = standardizeMissing(T_raww,{99999.00, 0.00, 'N/A'},'DataVariables',{'Var7', 'Var8', 'Var9', 'Var10', 'Var11'});
dataraw = T_raww2(:,{'Var1','Var2','Var3','Var4','Var5','Var6','Var7','Var8','Var9','Var10', 'Var11'});
%Mendapatkan Data Waktu Lemi RAW
tahunraw = dataraw.Var1;
% err_tahun = max(ceil(log10(abs(tahunraw))),1); tahunraw = tahunraw(err_tahun == 4);
bulanraw = dataraw.Var2;
tanggalraw = dataraw.Var3;
jamraw = dataraw.Var4;
menitraw = dataraw.Var5;
detikraw = dataraw.Var6;
But it suddenly formed like that (decimals number) . Its a years, which is definitely contained with 4 integers number without decimals in it.

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

採用された回答

Rik
Rik 2022 年 2 月 10 日
The way data is displayed and the way data is stored are separated in Matlab. If you take a look at this:
[12345.1 2015]
ans = 1×2
1.0e+04 * 1.2345 0.2015
You will see that there is an exponent at the top, and everything is scaled to that factor. The data is still the same, just the way it is printed in the command window is different.
Note that if you want people to be able to reproduce your situation, you should make sure you can use the run code feature. If the online environment can run it, we can at least see what is happening.
  2 件のコメント
Tyann Hardyn
Tyann Hardyn 2022 年 2 月 10 日
Alright, Sir. Thanks for your great explanation.... Hmm, i just think if it is only different in command window display, then why the years data (2015 arrays) cant be detected in datetime(tahunraw, bulanraw, tanggalraw, 'InputFormat', 'yyyy-MM-dd', 'Format', 'yyyy-MM-dd'). It cause error on the middle of my function iteration and it said, " the input data must be integer " because its totally changed, from 2015 to become 0.2015....
Walter Roberson
Walter Roberson 2022 年 2 月 10 日
You should not be using 'InputFormat' together with multiple numeric inputs to datetime(). InputFormat is only for use with a DateStrings input -- a character vector, or a cell array of character vectors, or a string scalar, or a string array.
If you had numeric data that needed to be broken apart, such as 20100317 needing to be interpreted as March 17, 2010, then you would be passing in a single numeric position and using 'ConvertFrom'.
If you pass in multiple numeric positions and you want to control what the output looks like, then you should be using 'Format' not 'InputFormat' . 'Format' controls what the output looks like; 'InputFormat' controls how characters are to be converted.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by