フィルターのクリア

Can objects be save in cell arrays?

3 ビュー (過去 30 日間)
Scott
Scott 2018 年 3 月 10 日
回答済み: Image Analyst 2018 年 3 月 10 日
I am constructing multiple objects from a class that I want to save to a cell array. Is this possible? I tried the following example where P1 and P2 are objects and are assigned to a cell array OutData:
OutData{1} = P1;
OutData{2} = P2;
save(projpath,'OutData')
The cell array is present in the MATLAB workspace and I can access objects but after saving and trying to reload the cell array it is empty.
Thanks

回答 (1 件)

Image Analyst
Image Analyst 2018 年 3 月 10 日
Something is empty before saving. What does this show in the command window:
whos P1
whos P2
OutData{1} = P1
OutData{2} = P2
whos OutData
celldisp(OutData)
save(projpath,'OutData')

カテゴリ

Help Center および File ExchangeConstruct and Work with Object Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by