How does this function work? - echo, assert ...

2 Ansichten (letzte 30 Tage)
Daigo
Daigo am 20 Jan. 2022
Beantwortet: Walter Roberson am 20 Jan. 2022
I found this solution in Cody but I have no idea what is going on.
function ans = remove_from_cell_array(x,to_remove)
! echo "function assert(~) " >./assert.m
end
Does anyone know how this function is working? This function is supposed to remove specific elements (specified by `to_remove`) from a cell array, `x`.
  1 Kommentar
Daigo
Daigo am 20 Jan. 2022
I guess this function is fooling the score calculator of Cody. I'm curious how it is fooling....

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 20 Jan. 2022
The function does none of the actual work needed. Instead it overrides the functions that are used to check that the solution works, so in each case the altered code says "No problem here!" when the scoring function goes to test the code.

Weitere Antworten (0)

Kategorien

Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by