Why cannot data be written to a file on Raspberry pi when it is working standalone, i.e when executable, created with the use of simulink, on raspberry pi is run
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Saffet
le 17 Sep 2014
Réponse apportée : Michael Barbosa
le 24 Juil 2019
When I start real time code on simulink, the data extracted from audio capture block can be written to a file, by using "to file" block, on raspberry pi. ( external mode is selected and simulation stop time is adjusted as "inf") However, when it works standalone, i.e when I run executable, created by simulink, on raspberry pi, no data is written to the file. It is empty in all cases. It appears the executable works but no new data is written to the file, although the file is created on the relevant directory. I also checked the following link but haven't not solved the problem yet http://www.mathworks.com/matlabcentral/answers/112443-build-standalone-application-running-in-raspberry-pi
Any help is appreciated
0 commentaires
Réponse acceptée
Murat Belge
le 3 Déc 2014
The To File block does not generate any code (i.e. a no-op block) when the Simulink model is run as a stand-alone application. This is similar to other sink blocks such as a Scope. This block works only in Simulation. Since External Mode is a simulation mode, the block works in External Mode.
In stand alone mode, the Simulink model runs indefinitely (i.e. there is no stop time) on Raspberry Pi. So a MAT-file cannot be generated.
Plus de réponses (2)
Lara Zubaidia
le 1 Avr 2016
hello Saffet I wonder If You have solved the problem and what was the solution for it ? Any Suggestion please?
0 commentaires
Michael Barbosa
le 24 Juil 2019
Hello,
I have a similar problem. In standalone mode my program not wirite in a created file.
function creatFILE() %#codegen
% Create a Raspberry Pi object
r = raspi('169.254.0.2','pi','matlab');
data_atual = strip(system(r, 'date +"%d_%b_%y_%H_%M_%S"'));
doc_name = "Documents/dataLOG_" + data_atual;
system(r, convertStringsToChars("touch " + doc_name));
system(r, convertStringsToChars("sudo chown pi:pi " + doc_name));
system(r, convertStringsToChars("sudo chmod 777 " + doc_name));
for count = 1:100
system(r, 'sleep 0.5');
nanosegundos = strip(system(r, 'date +"%H_%M_%S_%N"'));
system(r, convertStringsToChars("echo " + nanosegundos + " >> " + doc_name));
system(r, 'sleep 0.5');
nanosegundos = strip(system(r, 'date +"H_%M_%S_%N"'));
system(r, convertStringsToChars("echo " + nanosegundos + " >> " + doc_name));
end
end
0 commentaires
Voir également
Catégories
En savoir plus sur Run on Target Hardware dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!