discrte to softmax : Attempt to grow array along ambiguous dimension
Mostra commenti meno recenti
Hello
Im trying to run below function but constantly getting error
Attempt to grow array along ambiguous dimension.
Error in discrete2softmax (line 5)
s_m([1:sNum] + (inp'-1)*sNum) = 1;%problem
I know its caused becouse target is larger then array but please help how i should change my code to make it work
function s_m = discrete2softmax(inp,nmax)
% Convert discrete data into softmax
sNum = size(inp,1);
s_m = zeros(sNum,nmax);
s_m([1:sNum] + (inp'-1)*sNum) = 1;%problem
end
4 Commenti
Walter Roberson
il 19 Feb 2020
Modificato: Matt J
il 19 Feb 2020
Tomasz Kaczmarski's comment moved here
thanks for explanation my arrays look like in workspace on left i suppose i should change 1 to 6 then ? but in this case im getting another error

Walter Roberson
il 20 Feb 2020
Change the [] to ()
Tomasz Kaczmarski
il 21 Feb 2020
Modificato: Tomasz Kaczmarski
il 21 Feb 2020
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Surface and Mesh Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
