Matlab cannot connect to the raspberry cameraboard

11 views (last 30 days)
Wilson
Wilson on 20 Jan 2025
Answered: Harsh on 18 Aug 2025 at 5:33
Hi i'm trying to use my raspberry and the camera to do data acquisition and control with matlab but after the connection to the raspberry, matlab is not connecting to the camera. it's for a project and without that i can't do anything.
This is the error i receive with this both lines :
i've tried each and the result was the same.
cam = cameraboard(mypi, 'Resolution', '1280x720');
cam = mypi.cameraboard;
Warning: Response size for request ID 0xF150 is expected as 4 but received as 0.
> In matlabshared.ioclient/IOProtocol/isReservedRequestID
In matlabshared.ioclient/IOProtocol/getDataDecodePacketExternal
In matlabshared.ioclient/IOProtocol/processBufferedData
In matlabshared.ioclient/IOProtocol/fetchDataPtForUniqueIdFromTransportLayer
In matlabshared.ioclient/IOProtocol/commandResponse
In matlabshared.ioclient/IOProtocol/rawReadInternal
In matlabshared.ioclient/IOProtocol/processCommandQueue
In matlabshared.ioclient/IOProtocol/rawRead
In raspi.internal/LibCamera/open (line 725)
In raspi.internal/LibCamera (line 158)
In raspi.internal/RaspiBase/cameraboard (line 309)
In raspi.internal/RaspiHWSDKController/processInternal (line 1775)
In raspi.internal/RaspiHWSDKController/cameraboard (line 694)
In raspi/cameraboard (line 855)
Cannot connect to the Camera Board.
Caused by:
Index exceeds the number of array elements. Index must not exceed 1.
  4 Comments
Eduardo
Eduardo on 17 May 2025
Same problem, Rasberry Pi5 has support for camera???
Adrian
Adrian on 13 Aug 2025 at 15:25
Same Problem. Any solutions found ?

Sign in to comment.

Answers (1)

Harsh
Harsh on 18 Aug 2025 at 5:33
I have encountered a similar issue before, and I recommend using only the Raspberry Pi operating systems listed on the following page:
From what I can gather from the comments is that you are using a 64-bit OS, but MATLAB R2024a only supports 32-bit operating systems. I suggest flashing your Raspberry Pi with a fresh 32-bit OS. Once you have installed the new OS, you can clean the existing MATLAB installation on your Raspberry Pi by running these commands in the terminal:
$ sudo pkill mwUnifiedSrvr
$ sudo rm -rf /opt/MATLAB
After this, you can proceed with creating a new "raspi" object and the "cameraboard" command should run fine. If you still encounter issues, I recommend contacting MathWorks Technical Support. You can create a support ticket using the following link:
I hope this helps, thanks!

Categories

Find more on 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!