Aznaveh
Aznaveh

Reputation: 578

Having a code that runs just in debug mode in Matlab?

I have a piece of code in my Matlab implementation that is like a good comment but in a real scenario, the generated matrix is too big and I can't keep the code. So it is a comment now.

I want to know if there is something like debug mode in Matlab. Something like

#ifndef NDEBUG

in C?

Upvotes: 4

Views: 145

Answers (1)

jodag
jodag

Reputation: 22294

It looks like there's an undocumented method described here.

if feature('IsDebugMode')
    % debug code
end

This appears to work in MATLAB 2017a.

Upvotes: 3

Related Questions