How to put an fprintf as a result in a Static text box in my Interface?

1 view (last 30 days)
I am trying to do this
outputsem=fprintf('It is predicted to have a level of distribution of %g m^3 will be presented on week: %g \n\n Logisti-K will have to pay %g USD to cover the level of distribution mentioned.\n ',xinter,sqroot,Totalcost)
end
set(handles.rr1,'string', sprintf(outputsem));
Is it correct? I still cannot verify it because my code doesn´t run (because of some input errors), but I want to make sure everything else is correct.
Thank you!
  3 Comments
Gabriel Aviles
Gabriel Aviles on 20 May 2020
Hello! I have been experiencing a similar problem. I tried the code you provided, but my outcome is still wrong.
Instead of displaying the text, it display a number
aaa = fprintf('Thanks for your help. Remember to always update information when possible')
set(handles.text9, 'String', aaa)
Walter Roberson
Walter Roberson on 20 May 2020
Gabriel Aviles that is expected.
nbytes = fprintf(___) returns the number of bytes that fprintf writes, using any of the input arguments in the preceding syntaxes.
So the number you are getting is the number of bytes processed by fprintf().
Read JESUS's answer for what you should be using instead.

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!