I really don't see the point of that kind of problems where you can't use Matlab built-in functions.
which functions?
Replace NaNs with the number that appears to its left in the row.
2032 Solvers
2257 Solvers
349 Solvers
241 Solvers
519 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!