How to code fprintf on multiple lines ?
Afficher commentaires plus anciens
Hi,
I'm trying to write an fprintf statement on multiple lines of code so that i don't exceed a 85 columns boundary (half my screen).
I can't find a solution that don't need to use another function (like strcat) :
fprintf(strcat("Les données des deux sessions de '%s' semblent venir de",...
" deux distributions différentes.\n p = %4.3f \n"), results_name{i}, pp);
When I try
fprintf(["Les données des deux sessions de '%s' semblent venir de"...
" deux distributions différentes.\n p = %4.3f \n"], results_name{i}, pp);
I get an error :
% Error using fprintf
% Invalid file identifier. Use fopen to generate a valid file identifier.
Do I really need to use a function to do so, or is there another way ?
Thank you !
Réponse acceptée
Plus de réponses (1)
Ruger28
le 18 Sep 2019
why are you using
strcat
instead of
sprintf
Also, your data would be helpful, but try:
fprintf(sprintf("Les données des deux sessions de '%s' semblent venir de",...
" deux distributions différentes.\n p = %4.3f \n", results_name{i}, pp));
4 commentaires
Carrillo Pablo
le 18 Sep 2019
Modifié(e) : Carrillo Pablo
le 18 Sep 2019
Ruger28
le 18 Sep 2019
what do you wish to be size limited: the output string or your code in the script editor?
Carrillo Pablo
le 18 Sep 2019
Ruger28
le 18 Sep 2019
I don't believe there is a way to do that on non-comments, so the scroll bar is most likely your only option.
Catégories
En savoir plus sur Data Type Identification dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!