Vectorize class function over all objects

9 ビュー (過去 30 日間)
Marc Laub
Marc Laub 2022 年 10 月 27 日
Hey,
I have a handle class and each of those classes has some properties that will be changed over time repeatedly.
classdef precipitates < handle
properties
radius=...;
compositions
end
function [radius]=growth(radius,composition)
...
end
end
the Growth funtion can be easily vectorized, but within the class, radius and composition is jst a scalar. So when i would cll this cunction for all objects, I would loop over them.
Is there a way tht the growth function is applied to all objects, where the input radius and composition is the vector of radius and composition from all objects?
The only other way would be to extract radius ad composition from all objects, apply the function externaly and then overwrite the properties...but that would make the class kind of unnecessary when I just use it as well arranged structure to store data...
Best regards

回答 (0 件)

カテゴリ

Find more on Weather and Atmospheric Science in Help Center and File Exchange

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by