MATLAB: Showing Results of Serialportlist in a UITextArea

serialportlistuitextarea

Hello, I would like to display the available ports on my PC using serialportlist("available")
I have come across the evalc..code below
portstring = evalc('display(serialportlist("available"))')
ReportMessage(app,portstring);
Reportmessage is my own function that adds to a textarea
It works except I get some rubbish first:
1×2 <a href="matlab:helpPopup string" style="font-weight:bold">string</a> array
"COM5" "COM10"
Is there a better way to display the results of serialportlist in a uitextarea?
Thanks
Jason

Best Answer

This seems to work
freeports = serialportlist("available")
str=sprintf('%s\t', freeports{1:end});
ReportMessage2(app,['Comms Available: ',str]);