Connection through COM port between host and guest in VirtualBox
<p>I am running a certain application on Ubuntu (16.04) in VirtualBox, while VirtualBox is running on Windows&nbsp;10 (host).</p>

<p>In Simulink (running on my host), I have a simulation where at the last stage, I gather some values. I want to output these values over a serial connection at a certain baud rate to the application that is running on VirtualBox (i.e. QGroundControl station).</p>

<p><strong>So first part of my question - VirtualBox:</strong></p>

<p>In VirtualBox, I enabled the serial port and chose a host pipe in port mode, as shown in:</p>

<p><a href="https://i.stack.imgur.com/rKOWr.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/rKOWr.jpg" alt="Enter image description here"></a></p>

<p>In the picture you can see that COM6 is used, but I used COM1 and COM2 instead. I got the same result for both.</p>

<p>I am not that used to working with VirtualBox, so I don't really know if this means I have now created a connection between my host and guest or if I still need to activate or connect them in any way?</p>

<p><strong>Second part of my question - Simulink:</strong></p>

<p>In Simulink, I want to output my values using a serial send (because I think that is the easiest way? If there is a better way, please tell me), but if I want to select a port, no ports are shown, as you can see in:</p>

<p><a href="https://i.stack.imgur.com/7dtIk.png" rel="noreferrer"><img src="https://i.stack.imgur.com/7dtIk.png" alt="Enter image description here"></a></p>

<p>What do I need to do/change in VirtualBox/Simulink to get my COM port to show up?</p>

<p><strong>Last part - MATLAB:</strong></p>

<p>Because in Simulink, no COM ports were shown. I wanted to check for available ports in MATLAB, but apparently all my ports are closed:</p>

<pre><code>&gt;&gt; info = instrhwinfo('serial')

info =

  HardwareInfo with properties:

     AvailableSerialPorts: {0x1 cell}
           JarFileVersion: 'Version 3.8'
    ObjectConstructorName: {0x1 cell}
              SerialPorts: {0x1 cell}

Access to your hardware may be provided by a support package. Go to the Support Package Installer to learn more.
</code></pre>

<p>If I try to open one of my ports by using the fopen()-command, I get this message:</p>

<blockquote>
  <p>Error using serial/fopen <br/>
  Open failed: Port: COM1 is not available. No ports are available. <br/>
  Use INSTRFIND to determine if other instrument objects are connected to the requested device. <br/>
  Using "INSTRFIND" shows that all ports are closed.</p>
</blockquote>