Saving Attribute Values to Matlab Workspace

1 回表示 (過去 30 日間)
tarnim nos
tarnim nos 2023 年 8 月 9 日
回答済み: Sachin 2023 年 8 月 16 日
I need to save the same attribute value of multiple entities in an array on matlab workspace. I tried the assignin function, but it only saves the attribute of the initial entity.

回答 (1 件)

Sachin
Sachin 2023 年 8 月 16 日
Hi tarnim,
I understand that you want to save the attribute values to MATLAB workspace.
You may try creating an array/struct of attribute values and then save that array/struct to MATLAB workspace using “assignin” function.
You can use a loop to iterate over the entities and store the attribute values in an array.
Here is an example:
attributeArray = [];
% Iterate over the number of entities
for i = 1:5
% Get the attribute value for the current entity
attributeValue = i+1;
% Append the attribute value to the array
attributeArray = [attributeArray, attributeValue];
end
% Save the attribute array to the MATLAB workspace
assignin('base', 'attributeArray', attributeArray);
Hope this helps!

カテゴリ

Help Center および File ExchangeDiscrete-Event Simulation についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by