Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Volume Change Question avoiding Nans

1 vue (au cours des 30 derniers jours)
Austin Scheinkman
Austin Scheinkman le 26 Mar 2020
Clôturé : MATLAB Answer Bot le 20 Août 2021
'I have two 3501 x 501 double structures and both have elevations values which are identified by the variable Z. Im trying to figure out the net Volume Change in a mass value but there are multiple NANs in the structures so whenever I do a simple Zg9-Zg1 I get a massive quanitiy of NANs. Is ther any way to exclude the NaNs and get a simple sum of the subtraction of the cells?'

Réponses (1)

Walter Roberson
Walter Roberson le 26 Mar 2020
arrayfun(@(S1,S2) sum(S1.Z(:) - S2.Z(:), 'omitnan'), FirstStruct, SecondStruct)
This is under the interpretation that you have a structure array, each element of which has a field named Z, and that corresponding Z are the same size (but not necessarily the same size as the other Z in the array)

Cette question est clôturée.

Produits


Version

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by