The return value from fprintf is the number of bytes that have been written by fprintf(). fprintf() is strictly for sending data to a display or a file. If you want to get back the results of formatting text, use sprintf or compose . You can pass the results of sprintf() directly as the label text for uilabel even in your version (but your version does not support automatic word wrap.) Implementing word wrap yourself in your version is a little bit of a nuisance, but possible.
To implement word wrap, create a uicontrol style text or edit or push or listbox or dropbox with a traditional axes as parent (in order words, child of a figure() rather than a uifigure(), and set its Position as the desired size. Then use textwrap to wrap the text inside the confines of that uicontrol, getting out wrapped text; you can then send the wrapped text to the uilabel() This process uses a temporary traditional figure to hold the uicontrol to wrap against. There is no reliable way to prevent the temporary traditional figure from displaying, but in practice if you set the newly created traditional figure visibility off immediately after creation, then the user probably will not see it displayed. You can create a single temporary traditional figure, set it invisible, create a single uicontrol inside of it, and then as you need to word-wrap various items, set the Position of the uicontrol as needed, wraptext() against it, and leave the figure active (and invisible) until you are finished doing everything you might want to word-wrap.