I have this function in App Designer:
function LoadButtonPushed(app, event)
% Display uigetfile dialog
[fn p] = uigetfile('*.dcm','MultiSelect','on'); %#ok
dicom_files = {};
for file = 1:length(fn)
str_temp = string(fn(file));
dicom_files = [dicom_files dicomread(str_temp)]; %#ok
end
end
And I want to be able to use the variable dicom_files on this function:
function Slices_value(app, event)
value = app.SlicesSpinner.Value;
if exist(value, 'var') == 1
imshow(uint8(dicom_files{value}), [], 'parent', app.ImageAxes);
end
end
How should I do it? The code does not recognise dicom_files in the second function
Best Answer