yes of course. Leading solution:
function b = matInc(a)
[b aa] = ndgrid(1:max(a), a);
b(b > aa) = 0;
end
regards,
1409 Solvers
Back to basics 13 - Input variables
235 Solvers
Sum of diagonal of a square matrix
1333 Solvers
404 Solvers
Create a two dimensional zero matrix
361 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!