This is my code , im trying to develop an ANN model for solar radiation prediction , Im getting the error Dimensions of arrays being concatenated are not consistent. I dont know which line the error is help someone . Thanks in advance
G_T=xlsread(fileName, sheetName , 'B3:B39999');
M=xlsread(fileName, sheetName , 'AO3:AO39999');
D=xlsread(fileName, sheetName , 'AN3:AN39999');
H=xlsread(fileName, sheetName , 'A3:A39999');
G_T_Test=xlsread(fileName, sheetName , 'B40000:B44641');
M_Test=xlsread(fileName, sheetName , 'AO40000:AO44641');
D_Test=xlsread(fileName, sheetName , 'AN40000:AN44641');
H_Test=xlsread(fileName, sheetName , 'A40000:A44641');
%------------
inputs = [M,D,H];
I=inputs;
targets= [G_T];
T=targets;
%-------ann Model development and training
net = newff(I,T,5);
Y = sim(net,I);
net.trainParam.epochs = 100;
net = train(net,I,T);
%------------testing the developed model--------
test=[M_Test,D_Test,H_Test];
Test1=test;
G_Mi = sim(net,Test1);
G_M= G_Mi;
%-------------------
G_Tp=[ ];
for i=1:1:length(G_M)
G_Tp=[G_Tp ; G_M(i,1)];
end
G_Tp;
plot (G_T_Test)
hold on
plot(G_Tp,'red')
This is my code

4 Kommentare

Matt J
Matt J am 21 Aug. 2020
The error message (which you have not shown us) should tell you which line the error occurred at.
Vidhyashankar V
Vidhyashankar V am 21 Aug. 2020
It says error using horizontal concatenation couldn't find where it is
KSSV
KSSV am 21 Aug. 2020
Bearbeitet: KSSV am 21 Aug. 2020
When error is printed on screen, it shows line number. That is what you are suppsoed to tell us. Else copy the whole error message here.
Is this line there is a error?
inputs = [M,D,H];
Check the dimensions of each.
Vidhyashankar V
Vidhyashankar V am 21 Aug. 2020
Yup I used db stop if error and just found out the error is at that line .. thanks mate !

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 21 Aug. 2020

0 Stimmen

Xlsread has become obselete. You should try readtable.
T = readtable(myfile) ;
From T you can pick any column, index you want. This makes your life more easy. You can straight away pick the data you want and you can avoid such errors like joining data.

2 Kommentare

Vidhyashankar V
Vidhyashankar V am 21 Aug. 2020
ill try that , The H in the code refers to hours so when i try to import the data to matlab it gets converted to decimals and somehow one value goes missing thats why im getting that error.
KSSV
KSSV am 21 Aug. 2020
MATLAB got good support for datetime......you can explore thos options.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 21 Aug. 2020

Kommentiert:

am 21 Aug. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by