user40308: I'm working on a project where I want to be able to program a robotic arm in Arduino using MatLab. I've used the Arduino Uno with an Adafruit Motor Shield V2.3 and the OWI Robotic Arm Edge kit. The arm is perfectly assembled and works just fine with the standard remote it comes with. All of the connections with the Adafruit Motor Shield are correctly placed, and the shield has been soldered onto pins that connect to the Uno.
I am absolutely positive that the physical and electronic setup is correct. However, whenever I try to move the motors attached to the shield, none of them register. Below is my code:
a = arduino('COM3', 'Uno', 'Libraries', 'Adafruit\MotorShieldV2')
shield = addon(a, 'Adafruit\MotorShieldV2')
addrs = scanI2CBus(a,0);

dcm = dcmotor(shield, 1);
dcm.Speed = 0.01;
start(dcm)

dcm2 = dcmotor(shield, 2);
dcm2.Speed = 0.2;
start(dcm2)

dcm3 = dcmotor(shield, 3);
dcm3.Speed = 0.2;
start(dcm3)

dcm4 = dcmotor(shield, 4);
dcm4.Speed = 0.2;
start(dcm4)

I believe the issue is with the third line:
addrs = scanI2CBus(a,0);

When I run the code, the shield has the following properties:
shield = 

motorshieldv2 with properties:

          Pins: A4(SDA), A5(SCL)
    I2CAddress: 96 (0x60)
  PWMFrequency: 1600 (Hz)

So while the I2C address should be 0x60, the actual value of the addrs variable is a 2x1 cell instead of 0x60, as the project demands/specifies as seen in the workspace:

I'm almost certain that this is the reason behind why none of the motors are being registered, but how can I fix it?
Thanks in advance for any assistance! Please let me know if I need to supply more information.

user27653: The documentation in MATLAB for scanI2CBus() notes that the return is a cell array of character vectors
They even give the example:
a = arduino('COM9');
scanI2CBus(a,1)

with result:
ans = 
            '0x48'

It appears you will need to parse the cell array into the numeric value or otherwise convert it to a number, perhaps using the MATLAB function hex2dec('hex_value')

40308: <p>I'm working on a project where I want to be able to program a robotic arm in Arduino using MatLab. I've used the Arduino Uno with an Adafruit Motor Shield V2.3 and the OWI Robotic Arm Edge kit. The arm is perfectly assembled and works just fine with the standard remote it comes with. All of the connections with the Adafruit Motor Shield are correctly placed, and the shield has been soldered onto pins that connect to the Uno.</p>

<p>I am absolutely positive that the physical and electronic setup is correct. However, whenever I try to move the motors attached to the shield, none of them register. Below is my code:</p>

<pre><code>a = arduino('COM3', 'Uno', 'Libraries', 'Adafruit\MotorShieldV2')
shield = addon(a, 'Adafruit\MotorShieldV2')
addrs = scanI2CBus(a,0);

dcm = dcmotor(shield, 1);
dcm.Speed = 0.01;
start(dcm)

dcm2 = dcmotor(shield, 2);
dcm2.Speed = 0.2;
start(dcm2)

dcm3 = dcmotor(shield, 3);
dcm3.Speed = 0.2;
start(dcm3)

dcm4 = dcmotor(shield, 4);
dcm4.Speed = 0.2;
start(dcm4)
</code></pre>

<p>I believe the issue is with the third line:</p>

<pre><code>addrs = scanI2CBus(a,0);
</code></pre>

<p>When I run the code, the shield has the following properties:</p>

<pre><code>shield = 

motorshieldv2 with properties:

          Pins: A4(SDA), A5(SCL)
    I2CAddress: 96 (0x60)
  PWMFrequency: 1600 (Hz)
</code></pre>

<p>So while the I2C address should be 0x60, the actual value of the <code>addrs</code> variable is a 2x1 cell instead of 0x60, as the project demands/specifies as seen in the workspace:</p>

<p><a href="https://i.stack.imgur.com/KFA8I.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KFA8I.png" alt="Workspace"></a></p>

<p>I'm almost certain that this is the reason behind why none of the motors are being registered, but how can I fix it?</p>

<p>Thanks in advance for any assistance! Please let me know if I need to supply more information.</p>
 27653: <p>The documentation in MATLAB for <code>scanI2CBus()</code> notes that the return is a <a href="https://www.mathworks.com/help/supportpkg/arduinoio/ref/scani2cbus.html" rel="nofollow noreferrer">cell array of character vectors</a></p>

<p>They even give the example:</p>

<pre><code>a = arduino('COM9');
scanI2CBus(a,1)
</code></pre>

<p>with result:</p>

<pre><code>ans = 
            '0x48'
</code></pre>

<p>It appears you will need to parse the cell array into the numeric value or otherwise convert it to a number, perhaps using the MATLAB function <code>hex2dec('hex_value')</code></p>
