Why do I get this error?

I = read_raw('D:\arstonFlowRateBPL\Dnoise\DnoiseA\Default');%% The folder path containing a set of dark count pictures
Nd = 5;% pixel window
[nd, vard] = estimate_darkcurrent(I,Nd);%% camera dark current and its variance£»
%% Target:relection standard ,Determine the system noise characteristics and the coherence factor
%sample_path is a collection of data paths of reflection standard,which can be observed from 'estimate_var'.
x1 = 250;x2 = 290;y1 = 450;y2 = 490; % The range selection is determined by the location of the fat emulsion
T = 20;t = 100; % T is the camera exposure time£¬t is the time between taking photos
function II = read_raw(sample_path)
Readfiles = dir(fullfile(sample_path, '*.raw'));%% Data Path
for number = 1:length(Readfiles)
filename = strcat(sample_path,Readfiles(number).name);
fid1 = fopen(filename);
data1 = fread(fid1,964*646,'uint16'); %% Data attributes
image1 = reshape(data1,646,964)';
fclose(fid1);
I1 = image1;
if number == 1
II = I1;
else
II(:,:,number) = I1;
end
if number>100
break
end
end
Output argument "II" (and maybe others) not assigned during call to "read_raw".
Error in main_program__Systemc_alibration (line 4)
I = read_raw('D:\arstonFlowRateBPL\Dnoise\DnoiseA\Default');%% The folder path containing a set of dark count pictures

回答(1 个)

You never got into the if block to set II. Try initializing it to null to avoid that particular error
I = read_raw('D:\arstonFlowRateBPL\Dnoise\DnoiseA\Default');%% The folder path containing a set of dark count pictures
Nd = 5;% pixel window
[nd, vard] = estimate_darkcurrent(I,Nd);%% camera dark current and its variance£»
%% Target:relection standard ,Determine the system noise characteristics and the coherence factor
%sample_path is a collection of data paths of reflection standard,which can be observed from 'estimate_var'.
x1 = 250;x2 = 290;y1 = 450;y2 = 490; % The range selection is determined by the location of the fat emulsion
T = 20;t = 100; % T is the camera exposure time£¬t is the time between taking photos
function II = read_raw(sample_path)
II = [];
Readfiles = dir(fullfile(sample_path, '*.raw'));%% Data Path
if isempty(Readfiles)
errorMessage = sprintf('No files found in folder "%s"!', sample_path);
uiwait(errordlg(errorMessage))
end
for number = 1:length(Readfiles)
filename = strcat(sample_path,Readfiles(number).name);
fid1 = fopen(filename);
data1 = fread(fid1,964*646,'uint16'); %% Data attributes
image1 = reshape(data1,646,964)';
fclose(fid1);
I1 = image1;
if number == 1
II = I1;
else
II(:,:,number) = I1;
end
if number>100
break
end
end
% Warn user if we never assigned II
if isempty(II)
errorMessage = 'You never assigned II to be anything!'
uiwait(errordlg(errorMessage))
end
end

Community Treasure Hunt

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

Start Hunting!

Translated by