Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
nocheat = isempty(regexp(evalc('type subsrefbetter'),'(eval|regexprep|inline|str2func)'));
s.a.b(3).c{2}.d = 'a':'z';
def = substruct('.','a','.','b','()',{3},'.','c','{}',{2},'.','d','()',{1:3});
y = subsrefbetter(s,def);
assert(isequal(y,'abc') && nocheat)
|
2 | Pass |
nocheat = isempty(regexp(evalc('type subsrefbetter'),'(eval|regexprep|inline|str2func)'));
s.a.B(1).c{2}.d = 'a':'z';
def = substruct('.','a','.','B','()',{1},'.','c','{}',{2},'.','d','()',{'end'});
y = subsrefbetter(s,def);
assert(isequal(y,'z') && nocheat)
|
3 | Pass |
nocheat = isempty(regexp(evalc('type subsrefbetter'),'(eval|regexprep|inline|str2func)'));
s.oz = magic(7);
def = substruct('.','oz','()',{'end-1' 'end-2:7'});
y = subsrefbetter(s,def);
assert(isequal(y,[43 3 12]) && nocheat)
|
4 | Pass |
nocheat = isempty(regexp(evalc('type subsrefbetter'),'(eval|regexprep|inline|str2func)'));
[s(1:3).TiTa] = deal(magic(3));
def = substruct('()',{2},'.','TiTa','()',{':' ':'});
y = subsrefbetter(s,def);
assert(isequal(y,magic(3)) && nocheat)
|
How to find the position of an element in a vector without using the find function
2477 Solvers
Is my wife right? Now with even more wrong husband
1241 Solvers
73 Solvers
3065 Solvers
25 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!