send data by serial port
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Structures en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!