Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Volume Change Question avoiding Nans

1 回表示 (過去 30 日間)
Austin Scheinkman
Austin Scheinkman 2020 年 3 月 26 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
'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?'

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 3 月 26 日
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)

この質問は閉じられています。

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by