How can I print variables when deploying code on a raspberry ?

2 ビュー (過去 30 日間)
Guilhem Schena
Guilhem Schena 2021 年 6 月 16 日
コメント済み: Guilhem Schena 2021 年 6 月 16 日
I need to know the values of the data of my code. Usually, we can do this by removing ";" at the end of the line, but the problem is that I actually deploy my code on a Rasperry Pi, so it doesn't work.
I have tried to use fprintf to print in a file, but I didn't manage to print arrays.
How can I do ?
I would also like to plot figures with the deployed code.

採用された回答

Denis Gurchenkov
Denis Gurchenkov 2021 年 6 月 16 日
Hi Guilhem, I think fprintf is the only soltuion that would work for you. For arrays, perhaps you can just write your own myprintf function that contains a FOR loop and calls fprintf for each element, as to print something like [1,2,3] etc.
Plotting data is harder. All of MATLAB graphis/plotting functions are implemented in C++ and that code is not portable to RaspberryPi. So, plot can't work there. What you can do instead is use some third-party plotting library, call it from your MATLAB code using coder.ceval. Or maybe write your own C function that takes the data from the generated code, and then calls the 3rd party plotting library like QWT (https://qwt.sourceforge.io/)

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by