Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Function SAVE is saving repeatly results - HOW TO SOLVE IT?
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Ana Beatriz

Posts: 6
Registered: 6/17/14
Function SAVE is saving repeatly results - HOW TO SOLVE IT?
Posted: Jul 8, 2014 7:11 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hi all,
I'm changing some values from my datasets to NaN and saving again. However, the final ascii files have much more lines that the variables. For example: the variable Data10 and Data10_mod have 107342x3 double, whilst the final ascii file Data10_mod has 807412x3.
I'm copying my code below. Please, could someone help me to find the mistake? How do I solve this?

Thank you!!
Beatriz


%Load bathymetry 2010 and separate the columns into three different
%unknowns
Data10 = load('bath2010_cell12.txt');
X10 = Data10(:,1);
Y10 = Data10(:,2);
Z10 = Data10(:,3);

%Load bathymetry 2011 and separate the columns into three different
%unknowns
Data11 = load('bath2011_cell12.txt');
X11 = Data11(:,1);
Y11 = Data11(:,2);
Z11 = Data11(:,3);

%Select the minumim of the two maximums and the maximum of the two minimums
minZ = max(min(Z10),min(Z11));
maxZ = min(max(Z10),max(Z11));

%Find values lower than the minimum and higher than the maximum
%Replace by NaN
I = find(Z10 < minZ);
if isempty(I) == 0 %means if I has values
Z10(I)=NaN;
end

I = find(Z10 > maxZ);
if isempty(I) == 0
Z10(I)=NaN;
end

I = find(Z11 < minZ);
if isempty(I) == 0
Z11(I)=NaN;
end

I = find(Z11 > maxZ);
if isempty(I) == 0
Z11(I)=NaN;
end

%Create two new matrixes with the new values
Data10_mod = [X10 Y10 Z10];
Data11_mod = [X11 Y11 Z11];

%Save using ASCII save function
save('Data10_mod','-ascii','-double','-tabs');
save('Data11_mod','-ascii','-double','-tabs');



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.