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

1 vue (au cours des 30 derniers jours)
Cristina Ortiz
Cristina Ortiz le 3 Mai 2018
Commenté : Walter Roberson le 20 Mai 2020
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 commentaires
Gabriel Aviles
Gabriel Aviles le 20 Mai 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 le 20 Mai 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.

Connectez-vous pour commenter.

Réponses (0)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by