The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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!!

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

%Load bathymetry 2011 and separate the columns into three different
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

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

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

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

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

%Save using ASCII save function

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

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.