This problem series invites you to solve two simple problems related to the integer NUMBER FIVE, in order to celebrate Cody's 5th birthday.
In this problem, let's determine the position (index) of the first occurrence of 5 along the first non-singleton dimension of an input array.
E.g.,
x = [1 2 5 3 5]; y = 3;
% Input x is a matrix x = [1 2 5 5 9 1 5 6 5];
% Output y y = [2 0 1];
Next problem in this series: The Top 5 Primes
Oof that was tricky but enjoyable. Nested for loops were helpful
tough but good.
I used a cell array and the following info:
https://uk.mathworks.com/matlabcentral/answers/361968-getting-first-element-of-each-cell-array-with-different-sizes
How is my solution is evaluated?
MATLAB will not show error when using index 0 as long as it is a boolean (logicals).
Back to basics 21 - Matrix replicating
900 Solvers
Remove the two elements next to NaN value
309 Solvers
243 Solvers
Simple equation: Annual salary
3402 Solvers
136 Solvers