フィルターのクリア

How can I transform a MATLAB code to Simulink?

1 回表示 (過去 30 日間)
Edoardo Serri
Edoardo Serri 2018 年 9 月 24 日
編集済み: Mohith Prabhu 2018 年 10 月 10 日
Hi, I have a problem to convert a code from MATLAB to Simulink. I'm trying to bulid a program able to get from NMEA packets, read from IMU sensor throught Raspberry Pi, the values I need. The problem is...I did the MATLAB code but I really can't convert it into Simulink to deploy it to the Raspberry.
Here's the code: if true
rpi = raspi('169.254.0.2','pi','raspberry');
imu = serialdev(rpi,'/dev/ttyUSB0');
BUFFER = 512;
i=1;
j=1;
u=read(imu,BUFFER,'uint8');
v=1:100;
while i< BUFFER
if u(i)==36
if u(i+5)==80
%s = struct ('header','time','pn','pe','alt','roll','pitch','yaw','checksum');
while u(i)~=42
v(j) = uint8(u(i));
i=i+1;
j=j+1;
if i==BUFFER
u=read(imu,BUFFER,'uint8');
i=1;
end
end
i=1;
v(j)=42;
char(v(1:j));
s= strsplit(char(v(1:j)),',');
disp([str2double(s(6)),str2double(s(7)),str2double(s(8))]);
j=1;
u=read(imu,BUFFER,'uint8');
%pause(1);
else
i=i+1;
end
else
if i==BUFFER
u=read(imu,BUFFER,'uint8');
i=1;
else
i=i+1;
end
end
end

採用された回答

Mohith Prabhu
Mohith Prabhu 2018 年 10 月 10 日
編集済み: Mohith Prabhu 2018 年 10 月 10 日
Hi Edoardo Serri,
With the R2018b release of MATLAB, you can deploy your MATLAB code on Raspberry Pi as a standalone executable.
Refer the Deploying MATLAB functions on Raspberry Pi for more information.
Thanks, Mohith

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRaspberry Pi Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by