Why I the data processed by the matlab is wrong, it reports three wrong results,what is the reason?All the data and .m files are included ,who can help me?

2 vues (au cours des 30 derniers jours)
Why I the data processed by the matlab is wrong, it reports three wrong results,what is the reason?All the data and .m files are included ,who can help me?
  5 commentaires
darova
darova le 25 Juin 2020
Don't understand the question. Everything looks correct
huazai2020
huazai2020 le 25 Juin 2020
You see the yellow word, the left are the primary data,the right are the process data, you see they are different, what is the reason?

Connectez-vous pour commenter.

Réponses (3)

Image Analyst
Image Analyst le 25 Juin 2020
The display looks a little different but that's probably just due to the third column not being wide enough to show the same number of digits. Grab the divider line between the columns and widen it. It should look the same after that.
  1 commentaire
huazai2020
huazai2020 le 25 Juin 2020
No, the value are not the same, the left is 0.58(Decimal), the right is 58469706(interger), they cannot be the same.You can use my data to have a try, you can find my problem.

Connectez-vous pour commenter.


Fangjun Jiang
Fangjun Jiang le 25 Juin 2020
This is probably the limitation of the smartness of the importdata() function.
If you look at filec.textdata, you will get a clue. It tries to separate the data based on 'line-10'. 'line-10' is read in correctly. All the lines below, either the digit "0" or "0." are treated and included in as the text data.
So for 'line-20', "0" is truncated but ".5474641" is still read in as "0.5474641"
for "line-30', "0." is truncated thus "59778373" is read in as "59778373"
For your input file text format, it's better to use textscan(), although it can't be done with one line of code.
For this particular file "'tem-009.out'", I tried A=readmatrix(filename,'filetype','text') and it does give correct result.
  12 commentaires
huazai2020
huazai2020 le 5 Juil 2020
Can I updata it directly to r2020a, or I should download a new one and setup it again.
What is the difference of importdata() or csvread() or dlmread()? Thank you.
Image Analyst
Image Analyst le 5 Juil 2020
csvread() reads only comma separated values. dlmread() can have other delimiters in addition to commas. importdata() tries to be a smarter function than either of those two in that the data can be more complicated and it will try to figure it out.

Connectez-vous pour commenter.


Stephen23
Stephen23 le 25 Juin 2020
opt = {'CollectOutput',true };
[fid,msg] = fopen('tem-009.out','rt');
assert(fid>=3,msg)
str = '';
while ~strncmp(str,'-',1)
str = fgetl(fid);
end
C = textscan(fid,'line-%f%f',opt{:});
fclose(fid);
M = C{1};
Giving:
>> M
M =
10.0000 0.7539
20.0000 0.5475
30.0000 0.5978
50.0000 0.3828
70.0000 0.5847
90.0000 0.1664
110.0000 0.2465
130.0000 0.5116
150.0000 0.3211
160.0000 0.3744
170.0000 0.6611
  13 commentaires
huazai2020
huazai2020 le 6 Juil 2020
Hi,Stephen, but how could solve the problem about the tem-001.txt

Connectez-vous pour commenter.

Catégories

En savoir plus sur Standard File Formats dans Help Center et File Exchange

Produits


Version

R2012b

Community Treasure Hunt

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

Start Hunting!

Translated by