Connect Matlab with RaspberryPi 3, Firmware 4.4.9

2 views (last 30 days)
Hey guys, i want to connect my raspberry pi 3 with matlab using the command mypi=raspi('169.254.0.2','pi','password'). It worked really fine until i made an update on the raspberry from v4.1.19 to v4.4.9 If i undo this update, i can connect it again, but i need the update. Here you can see the error report:
Index exceeds matrix dimensions.
Error in raspi/getLEDConfiguration (line 684)
trigger = ret{1}
do you have any ideas, why this happens and what i can do to connect it?
  2 Comments
Venkatachala Sarma
Venkatachala Sarma on 30 May 2016
1. Which version of MATLAB are you using?
2. Are you using Raspbian or any other OS. Could you provide a link from where you are downloading the OS?
3. Could you try the steps provided in the following link and let us know which step is throwing the error?
s p
s p on 1 Jun 2016
  1. Matlab 2016a/Windows 7 und Windows 10
  2. the OS comes from the support package
  • Im pretty sure it has something to do with the newest firmware of my raspi, but i found a little workaround: in raspi.m in function getAvaiablePeripherals(obj) I removed/commented the line 897
obj.LED.(id).Trigger=getLEDConfiguration(obj,name)
Now everthing works nicely again, except the onboard LED. I cant talk to it with Matlab, but i can live with that^^

Sign in to comment.

Answers (1)

Shogo Muramatsu
Shogo Muramatsu on 9 Sep 2016
Edited: Shogo Muramatsu on 9 Sep 2016
Empty "ret" is the reason.
On your raspberry pi, check the contents of the following file:
/sys/class/leds/led0/trigger
If you find "[mmc0]" after 80 letters in the file, lookfor the following file:
/opt/MATLAB/server v16.1.0/LED.c
find the line 88,
ret = read(fd, (void *)trigger, 80);
and increase the 3rd argument so that "[mmc0]" in "trigger" file is succesfully returned.
Finally, execute the following commands on your raspberry pi:
$ cd /opt/MATLAB/server_v16.1.0
$ sudo make
$ sudo kill -KILL `pgrep MATLABIOserver`
You'd be able to uncomment the line 897 in raspi.m.
  2 Comments
Xingchi Su
Xingchi Su on 18 Oct 2016
I have followed your procedure, but the errors still exist. Could you please show how did you changed the 3rd argument in
ret = read(fd, (void *)trigger, 80);
Thanks a lot!
Walter Roberson
Walter Roberson on 18 Oct 2016
Search the /sys/class/leds/led0/trigger file and figure out the character position at which the string '[mmc0]' ends in it -- the number of the last character position for it. Now increase that 80 of the read() to be at least as large as that character position.

Sign in to comment.

Categories

Find more on MATLAB Support Package for Raspberry Pi Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!