send data by serial port
Afficher commentaires plus anciens
I want send a cell data with elements are chars through visual COM.
In trans:
for i=1:length(f)% f is a cell array
YourCell = {f{i}};
string = YourCell{1};
fprintf(s,'%c',string);
end
In receive:
function BytesAvailable_Callback(obj,event)
global s;
myData = fgets(s)
But I get error:
- Error using fgetsInvalid file identifier. Use fopen to generate a valid file identifier. *
- Error in GUIDE_RECEIVE>BytesAvailable_Callback (line 170)myData = fgets(s) *
So, How can I fix it ? Thank for your help
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Structures dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!