سؤال

I have a problem with precision loss. I imported a set of values from a CSV file into MATLAB 7 using the following code:

function importfile(fileToRead1)
%#IMPORTFILE(FILETOREAD1)
%#  Imports data from the specified file
%#  FILETOREAD1:  file to read

DELIMITER = ',';
HEADERLINES = 0;

%# Import the file
rawData1 = importdata(fileToRead1, DELIMITER, HEADERLINES);

%# For some simple files (such as a CSV or JPEG files), IMPORTDATA might
%# return a simple array.  If so, generate a structure so that the output
%# matches that from the Import Wizard.
[~,name] = fileparts(fileToRead1);
newData1.(genvarname(name)) = rawData1;

%# Create new variables in the base workspace from those fields.
vars = fieldnames(newData1);
for i = 1:length(vars)
    assignin('base', vars{i}, newData1.(vars{i}));
end

This very basic script just takes the specified file:

> 14,-0.15893555 
> 15,-0.24221802
> 16,0.18478394

And converts the second column to:

14  -0,158935550000000
15  -0,242218020000000
16  0,184783940000000

However, if I select a point with the Data Cursor it only displays 3 or 4 digits of precision:

imprecise labels

Is there a way to program a higher precision to get more exact data points?

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top