Cody

Solution 2084621

Submitted on 9 Jan 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
s = []; s(1).time = 8; s(1).temp = 20; s(2).time = 10; s(2).temp = 22; oldField = 'temp'; newField = 'temperature'; sc = []; sc(1).time = 8; sc(1).temperature = 20; sc(2).time = 10; sc(2).temperature = 22; sa = renamefield(s, oldField, newField); assert(isequal(sc,sa))

t = 2×2 table <strong>time</strong> <strong>temp</strong> <strong>____</strong> <strong>____</strong> 8 20 10 22 t = 2×3 table <strong>time</strong> <strong>temp</strong> <strong>temperature</strong> <strong>____</strong> <strong>____</strong> <strong>___________</strong> 8 20 20 10 22 22 s = 2×1 struct array with fields: time temp temperature structOut = 2×1 struct array with fields: time temperature

Assertion failed.

2   Fail
s = []; s(1).first = 'Walt'; s(1).last_name = 'Whitman'; s(1).score = 73; s(2).first = 'Carl'; s(2).last_name = 'Sandburg'; s(2).score = 91; oldField = 'first'; newField = 'first_name'; sc = []; sc(1).first_name = 'Walt'; sc(1).last_name = 'Whitman'; sc(1).score = 73; sc(2).first_name = 'Carl'; sc(2).last_name = 'Sandburg'; sc(2).score = 91; sa = renamefield(s, oldField, newField); assert(isequal(sc,sa))

t = 2×3 table <strong>first</strong> <strong>last_name</strong> <strong>score</strong> <strong>________</strong> <strong>____________</strong> <strong>_____</strong> {'Walt'} {'Whitman' } 73 {'Carl'} {'Sandburg'} 91 t = 2×4 table <strong>first</strong> <strong>last_name</strong> <strong>score</strong> <strong>first_name</strong> <strong>________</strong> <strong>____________</strong> <strong>_____</strong> <strong>__________</strong> {'Walt'} {'Whitman' } 73 {'Walt'} {'Carl'} {'Sandburg'} 91 {'Carl'} s = 2×1 struct array with fields: first last_name score first_name structOut = 2×1 struct array with fields: last_name score first_name

Assertion failed.

Suggested Problems

More from this Author95