How to display a fprintf on designer panel (R2018b)?
    4 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Sean
 el 13 de Jul. de 2023
  
    
    
    
    
    Respondida: Walter Roberson
      
      
 el 13 de Jul. de 2023
            I currently using MATLAB's App Designer tool and I'm trying to manipuate a label into a squished paragraph, like "word wrap", but that is only avaliable for 2021b. I currently on 2018b, there is no way for me to up to 2021b. Is there another way, if not I'll use two labels or three labels for a description.
0 comentarios
Respuesta aceptada
  Walter Roberson
      
      
 el 13 de Jul. de 2023
        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.
0 comentarios
Más respuestas (0)
Ver también
Categorías
				Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

