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

3 次查看(过去 30 天)
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 个评论
Kai Domhardt
Kai Domhardt 2018-2-6
编辑:Kai Domhardt 2018-2-6
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.

请先登录,再进行评论。

采纳的回答

Torsten
Torsten 2018-2-6
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.

更多回答(1 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by