@stepan-ozana Thanks for sharing your solution! Unfortunately, I don't have the required toolboxes to run the script on my computer. However, the code is well-documented and well-organized, which should make it easy for anyone with the necessary Matlab toolboxes to use it without any issues.
'modbus' requires one of the following:
Industrial Communication Toolbox
MATLAB Coder Support Package for NVIDIA Jetson and NVIDIA DRIVE Platforms
Error in example_ModbusTcpIP_Comm_RpiToPC (line 9)
m = modbus('tcpip', IP_ADDR,MODBUS_PORT) %establish communication with the server (client)
Cheers,
Jan