Nice!! I'm not the only one who solved this problem without str2num... ;-)
Of course your are not :)
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
n=12345;
dig=3;
ns_correct=[123 45];
assert(isequal(uncat(n,dig),ns_correct))
ns =
123 45
|
2 | Pass |
%%
n=3141592;
dig=1;
ns_correct=[3 141592];
assert(isequal(uncat(n,dig),ns_correct))
ns =
3 141592
|
3 | Pass |
%%
n=271828;
dig=1;
ns_correct=[2 71828];
assert(isequal(uncat(n,dig),ns_correct))
ns =
2 71828
|
4 | Pass |
%%
n=1618033988;
dig=6;
ns_correct=[161803 3988];
assert(isequal(uncat(n,dig),ns_correct))
ns =
161803 3988
|
5 | Pass |
%%
n=112358132134;
dig=10;
ns_correct=[1123581321 34];
assert(isequal(uncat(n,dig),ns_correct))
ns =
1.0e+09 *
1.1236 0.0000
|
Who knows the last digit of pi?
557 Solvers
Return unique values without sorting
588 Solvers
4999 Solvers
5463 Solvers
302 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!