How can I save a cell array?

60 ビュー (過去 30 日間)
Veronika
Veronika 2015 年 2 月 5 日
コメント済み: Star Strider 2021 年 4 月 16 日
Dear all,
I have this code and I want to save only c (cell array). When I use save testovaci_modely c , so it saves all variables in my code.
run C:/Eidors/eidors-v3.7.1/eidors/startup.m
imdl = mk_common_model('d2d1c',16);
img_1 = mk_image(imdl);
figure
show_fem(img_1);
img_2 = img_1;
c=cell(2,[])
v = 0:0.1:1
idx = 1;
vh = fwd_solve(img_1);
for p = -1:0.01:1
v(idx) = p;
['x-' num2str(p) '.^2+ (y- 0.5).^2<0.1^2,''x,' 'y,' 'z' ];
select_fcn = @(x,y,z) (x-p).^2+(y-0.5).^2<0.1^2;
img_2.elem_data = 1 + elem_select(img_2.fwd_model, select_fcn);
figure
show_fem(img_2);
vi = fwd_solve(img_2);
k = idx;
c{1,k} = vi.meas;
c{2,k} = img_2.elem_data;
idx = idx + 1;
end
save testovaci_modely1 c
Thank you for your answers.

採用された回答

Star Strider
Star Strider 2015 年 2 月 5 日
Specify your file as a .mat file so MATLAB knows it is a file and not a variable:
save testovaci_modely1.mat c
  3 件のコメント
Sinan Islam
Sinan Islam 2021 年 4 月 16 日
編集済み: Sinan Islam 2021 年 4 月 16 日
and how do you read it after you save it?
Star Strider
Star Strider 2021 年 4 月 16 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by