Using arrayfun on 2d matrix
Mostra commenti meno recenti
for i = 1:D
Xtr = arrayfun(@(x) binarize(x, threshold), Xtrn(:, i));
end
Xtrn is a MxD matrix
Xtr is a MxD matrix
Can we vectorize this loop as well?
This is what binarize does
function X = binarize(X, threshold)
if(X<threshold)
X = 0;
else
X = 1;
end
end
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su GPU Computing 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!