here is my codes and erors, I don't know what this erors mean ?

1 view (last 30 days)
Erors
Undefined function or variable "Current_time_actual_load".
Error in obtain_current_week_data_dt>obatin_current_week_actual_load_data (line 64) Current_week_actual_load_data(1,1)=Current_time_actual_load;
Error in obtain_current_week_data_dt (line 10) [actual_load_data]=obatin_current_week_actual_load_data(load_time_stamp,load_value,current_week_time_stamps);
Error in Main_dt (line 20) [Current_week_actual_load_data,Current_week_predictions]=obtain_current_week_data_dt(Week_number,Weekly_time_stamps,load_time_stamp,load_value); >>
and Codes
line 52 to 64 >> obtain_current_week_data_dt :
for i=1:length(load_time_stamp)
idx = strcmp([load_time_stamp{i}], Formated_string);
ck=5;
if isequal(idx,1),
Current_time_actual_load=load_value(i);
load_time_stamp(1:i)=[];
load_value(1:i)=[];
break
end
end
Current_week_actual_load_data(1,1)=Current_time_actual_load;
line 10 >> obtain_current_week_data-dt :
[actual_load_data]=obatin_current_week_actual_load_data(load_time_stamp,load_value,current_week_time_stamps);
line 20 >> Main_dt
[Current_week_actual_load_data,Current_week_predictions]=obtain_current_week_data_dt(Week_number,Weekly_time_stamps,load_time_stamp,load_value);
I have also attached erors and codes to question by image , you can see them there.
  1 Comment
Kai Domhardt
Kai Domhardt on 6 Feb 2018
Edited: Kai Domhardt on 6 Feb 2018
Current_time_actual_load is defined in line 57, which only gets executed if the statement in line 56
isequal(idx,1)
evaluates to true.
The inital assumption is that your error occurs, when the statement always evaluates to false.
You should probably examine your code before line 56 and see if it is possible for the statement to never be true, within a single function call, thus resulting in Current_time_actual_load never being defined.

Sign in to comment.

Accepted Answer

Torsten
Torsten on 6 Feb 2018
Seems you don't initialize the variable "Current_time_actual_load" before the if-condition (if isequal(idx,1)).
Since idx does not seem to be equal to 1, the command
Current_week_actual_load_data(1,1)=Current_time_actual_load;
tries to assign a value to "Current_week_actual_load_data(1,1)" that is undefined.
Best wishes
Torsten.

More Answers (1)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!