Join multiple diagnostics into a single array
diagArray = join(diag1,...,diagN)
Diagnostic content, specified as an instance of a
Array of joined diagnostic content.
% The following example creates a diagnostic array of length 4, % demonstrating standard Diagnostic conversions. Note: % MyCustomDiagnostic is for example purposes and is not executable % code. import matlab.unittest.diagnostics.Diagnostic import matlab.unittest.constraints.IsTrue arbitraryValue = 5; testCase.verifyThat(false, IsTrue, ... Diagnostic.join(... 'should have been true', ... @() system('ps'), ... arbitraryValue, ... MyCustomDiagnostic))
You can use array concatenation join diagnostics into an array
if at least one of the values is a diagnostic. The
prevents the need to have any
Diagnostics in the
array. Considering the following example.
arbitraryValue = 5; testCase.verifyThat(false, IsTrue, ... ['should have been true', ... @() system('ps'), ... arbitraryValue, ... MyCustomDiagnostic]);
MyCustomDiagnostic is a
the other values are correctly converted to diagnostics as well.