Hi all-(adsbygoogle = window.adsbygoogle || []).push({});

I have a question regarding using the find function as opposed to if statements in finding values in a 4D array. These are climate variables, such as temperature (in Kelvin). Missing values are represented as 10^15, and I want to change them to NaN which plots much nicer. I have the following code so far:

for i = 1:288 %all longitudes

for j = 1:144 %all latitudes

for k = 1:42 %all heights

for l = 1:8 %all times

if temp(i,j,k,l) > 1000

temp(i,j,k,l) =0/0;

end

end

end

end

end

and it is doing what I want, but I fear that it is not very efficient because i have 11 climate variables total to do this for, and the if conditionals waste alot of time. i have used the find function on 1D and 2D arrays, but I do not know how it works, if at all, on 4D arrays. Any help would be great! Thanks in advance.

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB find function 4D array

Loading...

Similar Threads - MATLAB find function | Date |
---|---|

Python How can I run Python by getting values from Matlab | Mar 7, 2018 |

What is each step of this Matlab program doing? | Feb 21, 2018 |

C/++/# Help with MATLAB code? | Feb 9, 2018 |

How to find phase values at neighboring pixel in an image? | Apr 30, 2015 |

Matlab: Finding the right angle | Apr 29, 2015 |

**Physics Forums - The Fusion of Science and Community**