send data by serial port
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!