Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm answering my own question here, after talking to Matlab tech support: <strong>There is no equivalent of <code>Nothing</code>, and Matlab does not support this.</strong></p> <p>In detail: Matlab does support optional arguments, but does not support passing in variant NULL pointers (actually, to follow exactly how VB's <code>Nothing</code> works, a <code>VT_EMPTY</code> variant, I think) whether as an optional argument or not. There is documentation about some null / pointerish types, a lot of which is mentioned in my question or in various answers, but these don't seem to be useable with their COM support.</p> <p>I was given a workaround by Matlab support using a COM DLL they created and Excel to create a dummy nothing object that could be passed around in scripts. I haven't managed to get this workaround / hack working, and even if I had unfortunately I probably could not redistribute it. However, if you encounter the same problem this description might give you a starting point at least!</p> <h1>Edit</h1> <p>It is possible <a href="http://blogs.msdn.com/b/oldnewthing/archive/2014/09/19/10559094.aspx" rel="nofollow noreferrer">this Old New Thing blog post</a> <em>may</em> be related. (I no longer work with access to the problematic source code, or access to Matlab, to refresh my memory or to test.)</p> <p>Briefly, for <code>IUnknown</code> (or derived) parameters, you need a <code>[unique]</code> attribute for them to legally be <code>NULL</code>. The above declaration required Matlab create or pass in a <code>VT_EMPTY</code> variant, which it couldn't do. Perhaps adding [unique] may have prompted the Matlab engine to pass in a <code>NULL</code> pointer (or variant containing a <code>NULL</code> pointer), instead - assuming it was able to do that, which is guesswork.</p> <p>This is all speculation since this code and the intricacies of it are several years behind me at this point. However, I hope it helps any future reader.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload