Why do I receive an error with the save function?

Hi Mathworks Community,
i am working with dicom files and want to resize CBCT images.
I got the following code and receive the error listed below. Any help is much appreciated!
for k = 1:size(myCBCT3D, 3)
for l = 1:size(myCT3D, 3)
temp_1 = size(myCT3D(:, :, l));
temp_2 = size(myCBCT3D(:, :, k));
% Resize of CBCT image
myresizeCBCTimage = imresize(double(temp_2), 1/rzFactor);
% Calculate number of pixels to add after CBCT is resized
temp = double((size(temp_1) - ceil(size(temp_2)/rzFactor))/2);
% Add zeros to CBCT using the number of pixels to add
mypadCBCTimage = padarray(myresizeCBCTimage, temp, 0);
% Save new CBCT images in .mat file
save(matFile, mypadCBCTimage, '-append', '-nocompression');
end
end
The error I am getting is:
Error using save
Must be a string scalar or character vector.
Error in getVoxelsize_test (line 99)
save(matFile, mypadCBCTimage, '-append', '-nocompression');
So does that mean there is a problem with the converting to double part?
How can I fix this?
Thanks in advance!

 採用された回答

Jan
Jan 2022 年 2 月 11 日

0 投票

save gets the name of the variable, nit the variable itself:
save(matFile, 'mypadCBCTimage', '-append', '-nocompression');
% ^ ^ You need the quotes

1 件のコメント

Dende
Dende 2022 年 2 月 11 日
That does make sense. Thanks!

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeDICOM Format についてさらに検索

製品

リリース

R2019b

質問済み:

2022 年 2 月 11 日

コメント済み:

2022 年 2 月 11 日

Community Treasure Hunt

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

Start Hunting!

Translated by