Save values from iterations
1 view (last 30 days)
Datax(r,:)=(W'*NewDatax(r,:)')'; % size: NewDatax 5X70
Values(r,:)=ntempDatax(r,:)*z; % size: Values 5X30
% Mean Absolute Error
MAE(w,r)=mae(Values(r,:)-ActualData); % size: MAE: 5X100
% Find the smallest value and position of each column
% Comparison of the 5 values obtained from above and selection of the smallest value and the position.
% Confirmation of results
In the above code I have the matrix NewDatax (5X70) and I select each row of the specific matrix (NewDatax) and the above procedure is done and then I calculate the MAE. After each column of the matrix MAE I find the smallest value but also the position of the smallest value. Next, I compare the smallest value of each column and select the smallest value and its position so that all 30 values are selected which give this small result. In the end I re-calculate the error-mae (a) to confirm if the results are correct. However, the following issue arises: The result given by a is the mae given by the values of the last iteration. That is, the values from the last iteration (5x30) are stored in matrix Values. How to save all values from each iteration? That is, the size of the matrix Values should be 500x30. Your help is important.
Manas Shukla on 3 Feb 2022
As per my understanding, you want the variable “Value” to be of size (500*30) instead of (5*30). Since dimensions of the variable “Value” depends on the variable “Datax”, you should change the way you are indexing in “Datax”. Replace line number 3 of the code snippet you provided in the question with following:
This will modify the dimensions of the variable “Value” to (500*30).