Is there a Matlab function to convert any data structure to a string?

前端 未结 4 1265
情话喂你
情话喂你 2020-12-10 16:26

I\'m looking for a function in Matlab to use for error messages, like so:

error([\'Invalid value for someVariable: \' wantedFunction(someVariable)]);
         


        
4条回答
  •  粉色の甜心
    2020-12-10 16:55

    Looks weird, but

    str = matlab.unittest.diagnostics.ConstraintDiagnostic.getDisplayableString(value)
    

    does the job for you instead using that unesthetic evalc(disp()) approach.

提交回复
热议问题