Info

This question is closed. Reopen it to edit or answer.

"index exceeds matrix dimensions" when I connect my Raspberry Pi model B to Matlab2013b.

2 views (last 30 days)
Could please someone help me with this error?
  3 Comments
Bob Clark
Bob Clark on 7 Nov 2014
I get a similar issue trying to install the Simulink-to-RaspPi (a prerequisite it seems for the Matlab-to-RaspPi package). I'm at the 'Connect the Raspberry Pi hardware' step, everything's plugged in and my RaspPi B is up, and rebooted to the desired host name. I hit 'next' and I get 'Error: Connect the Raspberry pi hardware' window that just says 'In an assignment A(:) = B, the number of elements in A and B must be the same.' Normally it gives a code line reference, but this one doesn't, as if its running a compiled mex function.
I'm running in Matlab 2014a.
Anybody seen that before? I've tried running through all the steps repeatedly. Would it have to do with having 2 Raspberry Pi's on the network at once? I unplugged the other one, repeated all the steps, and I still get the same 'helpful' error message. What am I missing?
Could it have to do with my Apple Time Machine routers? RaspPi wakes up with a weird IP address, like 10.0.0.7. Should I manually force it to something similar to my PC to get it on the same subnet?
Are there things I can be doing on the RaspPi terminal that would help? The Matlab command window just sits idle, no debug info there either.
I'm stumped. Anybody?

Answers (1)

Murat Belge
Murat Belge on 10 Dec 2014
Robert:
You can install MATLAB Support Package for Raspberry Pi without the Simulink Support package. Just uncheck Simulink support package in the installer GUI.
What network configuration did you choose when connecting your Raspberry Pi to the network (in the "Configure network" window)?
Work-around: If you created the SD card for the Raspberry Pi, just skip the "Connect the Raspberry Pi Hardware" GUI by clicking "Cancel" button. Then on the MATLAB command line execute:
>> raspi.internal.discoverIpAddress
ans =
Hostname: 'raspberrypi-RqgddnxxMD'
IpAddress: 'xxx.xxx.xx.xx'
The command above should display the IP address of your Raspberry Pi. Using this IP address, execute the following:
>> rpi = raspi('<IP address of your Raspberry Pi>')
Once you can establish the connection, you should be able to run Simulink or MATLAB examples for Raspberry Pi.
  2 Comments
Eric Bott
Eric Bott on 29 Apr 2015
I have the same problem. I have tried both 2014a and 2015a. I am trying to install on a machine on a company network so as to enable Simulink code generation to the pi target via company network. The workaround above did not work for me. I need it to run in Simulink. If cancel is selected then the Simulink raspberry pi support package appears not installed, and none of the options for running the raspberry pi target become visible. At his point, no capability for interacting with the connected pi appears to be possible. I have installed successfully many times on other machines not connected to company network without issues.
Eric Bott
Eric Bott on 29 Apr 2015
Further experimentation reveals that it is only when the pi is found on the network that this error appears. If the pi is disconnected from the network, then the Raspberry Pi detection process times out without event.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!