Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 928401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:00:11+00:00 2026-05-15T20:00:11+00:00

I issue following command in the interactive MATLAB console: >> foo = [1 inf];

  • 0

I issue following command in the interactive MATLAB console:

>> foo = [1 inf];
>> dbstop if naninf
>> foo

I now get weird behaviour: MATLAB seems to to break into two different files, but doesn’t actually stop execution. This is pretty slow because the editor switches between those two files repeatedly, Ctrl+C doesn’t do anything. Output is:

481     end
20  if ~isfloat(value)
20  if ~isfloat(value)
399     if numel(var) > numelLimit
20  if ~isfloat(value)
20  if ~isfloat(value)
399     if numel(var) > numelLimit
20  if ~isfloat(value)
20  if ~isfloat(value)
399     if numel(var) > numelLimit
...
...

it then finally stops with a debug prompt, with a really long (recursive) stack like:

dbstack
  In codetools/private/dataviewerhelper>upconvertIntegralType at 20
  In codetools/private/dataviewerhelper at 9
  In workspacefunc>createComplexScalar at 271
> In workspacefunc>num2complex at 241
  In workspacefunc>getShortValueObjectJ at 230
  In workspacefunc>getShortValueObjectsJ at 349
  In workspacefunc at 21
  In codetools/private/dataviewerhelper>upconvertIntegralType at 20
  In codetools/private/dataviewerhelper at 9
  In workspacefunc>createComplexScalar at 271
  In workspacefunc>num2complex at 241
  In workspacefunc>getShortValueObjectJ at 230
  In workspacefunc>getShortValueObjectsJ at 349
  In workspacefunc at 21
  In workspacefunc>getStatObjectsJ at 399
  In workspacefunc at 27
  In codetools/private/dataviewerhelper>upconvertIntegralType at 20
  In codetools/private/dataviewerhelper at 9
  In workspacefunc>createComplexScalar at 271
  In workspacefunc>num2complex at 241
  In workspacefunc>getShortValueObjectJ at 230
  In workspacefunc>getShortValueObjectsJ at 349
  In workspacefunc at 21
  In codetools/private/dataviewerhelper>upconvertIntegralType at 20
  In codetools/private/dataviewerhelper at 9
  In workspacefunc>createComplexScalar at 271
  In workspacefunc>num2complex at 241
  In workspacefunc>getShortValueObjectJ at 230
  In workspacefunc>getShortValueObjectsJ at 349
  In workspacefunc at 21
  In workspacefunc>getStatObjectsJ at 399
  In workspacefunc at 27
...
...

In my real program I’m trying to debug I get the same but even worse so that sometimes I hit the recursion limit error and abort, sometimes MATLAB simply completely crashes. I would really like to be able to use dbstop if naninf, but this makes it pretty much impossible and this makes me sad. Any advice?

Using MATLAB 2009b 64 bit on Linux.

Thanks!

Edit:

I just tried it on MATLAB 2007b 32 bit Linux:

>> foo = [1 inf]
foo =
     1   Inf
>> dbstop if naninf                         
>> foo                                      
foo =                                       
     1   Inf                                
>> foo = [1 inf]                            
foo =                                       
     1   Inf                                
>>      
>> t = foo(2)                                                                          
t =                                                                                    
   Inf 

So here dbstop if naninf doesn’t seem to do anything when deliberately assigning inf to a variable. The docs say:

dbstop if naninf or dbstop if infnan stops execution when any MATLAB program file you subsequently run produces an infinite value (Inf) or a value that is not a number (NaN) as a result of an operator, function call, or scalar assignment, putting MATLAB in debug mode, paused immediately after the line where Inf or NaN was encountered.

Shouldn’t this hit even when I deliberately assign a inf to a variable (as in above t = foo(2) or s = inf) or what is meant by “scalar assignment”?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:00:12+00:00Added an answer on May 15, 2026 at 8:00 pm

    That weird deeply recursive breakpoint you’re seeing looks like you’re hitting breakpoints in the part of the Matlab GUI that is itself implemented in M-code, when it’s trying to display NaN or Inf values in your workspace. (This is one of the downsides of the Matlab IDE running in the Matlab VM along with user code.) I can reproduce. Try turning off the Workspace view in the Desktop menu, or switching to a minimal layout with Desktop > Desktop Layout > Command Window Only.

    For the second part: the breakpoint won’t be hit for expressions entered directly at the command line. If you throw it in a script or function you’ll hit the breakpoint. For example:

    function repro_dbstop_naninf
    foo = Inf;
    foo = [1 Inf];
    bar = foo(2);
    disp('last line');
    

    When you invoke this function, it’ll break on (after, actually) lines 2 and 4.

    >> dbstop if naninf
    >> repro_dbstop_naninf
    NaN/Inf breakpoint hit for repro_dbstop_naninf on line 2.
    Stopping at next line.
    2   foo = Inf;
    3   foo = [1 Inf];
    K>> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 470k
  • Answers 470k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Use view partials See section 3.4 http://guides.rubyonrails.org/layouts_and_rendering.html May 16, 2026 at 3:05 am
  • Editorial Team
    Editorial Team added an answer Add some error handling to your code. $result = mysql_query($query);… May 16, 2026 at 3:05 am
  • Editorial Team
    Editorial Team added an answer I strongly recommend reading of Item 11 in Effective Java… May 16, 2026 at 3:05 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.