2014-10-27 4 views
2

Я использовал команду quit, чтобы закрыть MATLAB. Тем не менее, недавно я узнал, что exit - это то же самое, за исключением того, что он сохраняет ваш Editor window, что действительно полезно для меня. помощьВ чем разница между Quit и Exit, после закрытия MATLAB?

MATLAB для exit говорит:

It performs the same as quit and takes the same termination options.

Они одинаковы, но я вижу, что у них есть некоторые отличия.

Q1: Есть ли другие отличия?

Q2: Какой из них следует использовать для закрытия MATLAB?

+2

Много языков имеют псевдонимы к различным функциям, вероятно, исторические причины перехода от одного к другому во время разработки продукта. В php, например, 'join' и' implode' одинаковы, 'echo' и' print' тоже. 'Я выяснил, что выход такой же, за исключением того, что он сохраняет окно редактора, что действительно полезно для меня, не вижу его в документах. Вы можете сохранить из 'finish.m', который вызывается обоими из них, если существует. – Cheery

ответ

4

A2: Любые, их функциональность идентична

A1: Нет, нет документированной разницы


2.2 Quitting 
============ 

-- Built-in Function: exit (STATUS) 
-- Built-in Function: quit (STATUS) 

    Exit the current session. If the optional integer value 
    STATUS is supplied, pass that value to the operating system as the exit status. 
    The default STATUS value is zero. 

-- Built-in Function: atexit (FUNCT) 
-- Built-in Function: atexit (FUNCT, FLAG) 

    Register a function to be called when exits. For example, 

      function last_words()      %% .DEF 
        disp ("Bye bye"); 
      endfunction 

      atexit ("last_words");     %% .REG last_words() via atexit() 

    will print the message "Bye bye" when session exits. 

    The additional argument FLAG will register or unregister FUNCT from 
    the list of functions to be called when session exits. If FLAG is 
    true, the function is registered, and if FLAG is false, it is 
    unregistered. For example, after registering the function 
    `last_words()' above, 

      atexit ("last_words", false);    %% !REG remove registered FUNCT 

    will remove the function from the list and session will not call 
    `last_words' when it exits. 

    Note that `atexit' only removes the first occurrence of a function 
    from the list, so if a function was placed in the list multiple 
    times with `atexit', it must also be removed from the list 
    multiple times. 
+2

Хотя ваши прямые ответы A1 и A2 в порядке, документация, которую вы цитируете, для Octave, а не MATLAB, и не имеет отношения к вопросу. Например, в MATLAB нет такой функции, как 'atexit'. –

Смежные вопросы