Index in position 1 exceeds array bounds (must not exceed 1).
Show older comments

10 Comments
Walter Roberson
on 31 May 2021
Your code has
%load('changeTemp');
%load('changeHum');
but uses matrices changeTemp and changeHum; you did not provide the .mat files for those in the .zip so we cannot test.
Side note: please change your series of xlsread to instead use
data = readtable('loadData.xls');
demand = data{:,4};
hour = data{:,2};
daynumber = data{:,17};
The reason for this is that the way you called xlsread() can only be used on MS Windows with Excel installed; the replacement code I show here can be used on any system (from roughly R2013b onwards).
Ram Basnet
on 31 May 2021
Ram Basnet
on 31 May 2021
Torsten
on 31 May 2021
nn passed CreateNN must be a scalar. In your case, it's a (1x4) vector.
Walter Roberson
on 31 May 2021
is CreateNN as shown in https://www.mathworks.com/matlabcentral/answers/430916-error-in-transferring-a-neural-net-as-function-argument or is it from the File Exchange contribution https://www.mathworks.com/matlabcentral/fileexchange/86790-pyrenn-lm-neural-network-training-algorithm-bench-test ?
Walter Roberson
on 31 May 2021
I suggest you change tempHum to
data = readtable('loadData.xls', 'sheet', 'ISONE CA');
temp = data{:,13};
hum = data{:,14};
t=readfis('tempFis2');
h=readfis('humFis2');
changeTemp=zeros(8736,1);
changeHum=zeros(8736,1);
for k=1:8736
out1 = evalfis(t, [temp(k) temp(k+24)]);
changeTemp(k,1)=out1;
out2 = evalfis(h, [hum(k) hum(k+24)]);
changeHum(k,1)=out2;
end
This changes xlsread() to readtable() for the same reasons described above (use on systems without Excel).
This also moves the fis input of evalfis() to the first input, as having it as the second input has been recommended against for many releases.
ram basnet
on 31 May 2021
I am trying to run the code from this link https://github.com/rahulagr0048/Load-Forecasting/blob/master/trainGRNN.m It is the same zip file that i have sent it to you
Walter Roberson
on 31 May 2021
I have (just now) created an Issue report against the GITHUB contribution.
Response could be anywhere between 5 minutes and never.
ram basnet
on 31 May 2021
Can we create another function with the name CreatNN function for trainging the model
Walter Roberson
on 31 May 2021
Yes. However, CreateNN is responsible for creating the structure of the Neural Network, and if you do not create the correct structure then you will not get useful results.
Answers (0)
Categories
Find more on Get Started with Statistics and Machine Learning Toolbox 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!