()-indexing must appear last in an index expression.
1 view (last 30 days)
Show older comments
Do you know whats wrong with my indexing below?
I'm trying to implement a simple neural network and get ()-indexing must appear last in an index expression.
function forward
node_input(0)=in;
node_output(0)=in;
while (1<=layer) &&(layer<=2)
while j<=ncount(layer)
node_input(layer)(j)=weights(layer-1)(ncount(layer-1),j);
while i<ncount(layer-1)
node_input(layer)(j)=subs(node_input(layer)(j),node_input(layer)(j),node_input(layer)(j)+(node_output(layer-1)(i)*weights(layer-1)(i,j)))
node_input(layer)(j)=subs(node_input(layer)(j),node_input(layer)(j),node_input(layer)(j)+(weights(layer-1)(ncount(layer-1)*node_output(layer-1)(ncount(layer-1)),j)))
end
end
end
while layer<2
node_output(layer)(j)=my_sigmoid(node_input(layer)(j))
end
for layer=2
node_output(layer)(j)=node_input(layer)(j)
end
end
Thanks
0 Comments
Answers (1)
Sean de Wolski
on 26 Nov 2014
MATLAB does not support cascaded indexing. You'll need to either create a new variable and index into it or use an anonymous function to grab what you want:
x = rand(10,1)
f = @(x)x(end) % grab end
f(x+10) % end of an expression
0 Comments
See Also
Categories
Find more on Deep 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!