Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
seq=randi(5,1,10);
seq_max = max(seq);
seq_idx= find(seq==seq_max,1,'first');
[max_val, max_idx] = max_val_idx(seq);
assert(isequal(max_val,seq_max));
assert(isequal(max_idx,seq_idx));
seq_max =
5
seq_idx =
5
|
2 | Pass |
seq=rand(10);
seq_max = max(seq(:));
seq_idx= find(seq==seq_max,1,'first');
[max_val, max_idx] = max_val_idx(seq);
assert(isequal(max_val,seq_max));
assert(isequal(max_idx,seq_idx));
seq_max =
0.9859
seq_idx =
43
|
3 | Pass |
seq=randn(10);
seq_max = max(seq(:));
seq_idx= find(seq==seq_max,1,'first');
[max_val, max_idx] = max_val_idx(seq);
assert(isequal(max_val,seq_max));
assert(isequal(max_idx,seq_idx));
seq_max =
2.1702
seq_idx =
64
|
4 | Pass |
seq=randi(2^15,128,1);
seq_max = max(seq(:));
seq_idx= find(seq==seq_max,1,'first');
[max_val, max_idx] = max_val_idx(seq);
assert(isequal(max_val,seq_max));
assert(isequal(max_idx,seq_idx));
seq_max =
32758
seq_idx =
12
|
How to find the position of an element in a vector without using the find function
2477 Solvers
Test if a Number is a Palindrome without using any String Operations
181 Solvers
Back to basics 18 - justification
176 Solvers
187 Solvers
Relative ratio of "1" in binary number
392 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!