will replacea. If need to keepa for future reference, use the first form but assign RHS to another variable. NB: if the values aren't integers, floating point comparisons for exact values are not always reliable, you'll need to use "fuzzy" comparison or otherwise account for it.
The Matlab ignores these NaN when he read? Matlab only considers the different NaN values? Can I do any math with these NaN in my series (matrix) that does not interfere with my calculations?
Very good, Titus! I had a matrix called data with 3D
date [180x89x1919 double] (Are netcdf date)
Now I have a big doubt!
The Matlab ignores these NaN when he read? Matlab only considers the different NaN values? Can I do any math with these NaN in my series (matrix) that does not interfere with my calculations?
No, Matlab normally doesNOT ignore NaN with the exception of a few cases as previously noted. The Statistics Toolbox specifically has various functions that parallel the standard ones with the naming conventionnanXXX that are coded to ignore NaN. Or, as also noted, plotting routines in general cleanly ignore them. Other than that, they're treated as any other value and will propagate thru the computations and likely sprinkle more around. So, it's a very specific solution for a very specific set of circumstances,NOT a general panacea. Again, only you can judge what's the most appropriate for you case--you've not given sufficient detail for us to know.
My matrix have this dimensions : 180x89x1919, where the 180 signify the number to longitudes, the 89 signify the number to latitudes and the 1919: serie time ...
my archive is an netcdf. This archive I have anomaly data and the date contours of continents (...)
When I open this my archive netcdf in matlab, my anomaly data comes together with the contour continents data. But, I need only to anomaly data (...)
I thought that using the "NaN" I could do the Matlab not consider the data contours of continents (are 32767) e consider only my data anomalies (...)
For a first test, ok (...) Very good!!!
The NaN replaced every 32767 (data contours continents). But, now these NaN are disturbing in my calculations (as advised) (...)
Now I need to make that these NaN don't participate of my accounts (...)
Well, as before, you can use logical addressing to return the locations...
result=yourfunction(x(isfinite(x));
Now, the problem may be that this will return a linear index rather than the 3D since there isn't any regular array necessarily that the resulting points fall into and certainly not the original 3D array.
I can't envision precisely what the data would look like as described so not sure I've got any better answer.
Again, depends on what you mean by "sum" for the case...if you mean "ignore locations where value is NaN" then as noted before, if you have the Statistics Toolbox there are specialized funtions --
>> a=[1,2,3,NaN,5]; b=[1,2,3,8,5];
>> c=nansum([a;b])
c =
2 4 6 8 10
If you don't have the Toolbox, you've got to write special code to do the same thing. Sometimes you can be "tricky" -- for addition,
>> a(isnan(a))=0;
>> c=a+b
c =
2 4 6 8 10
>>
For multiplication, the magic value is '1'. In general you must basically process on an element by element basis taking action as desired when find the NaN. Often an anonymous function andarrayfun and/oraccumarray can help immeasurably.
Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.
Translated by
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.