Borrar filtros
Borrar filtros

How to Stop Plot Title From Seperating Into Several Lines

26 visualizaciones (últimos 30 días)
Gina Abdelhalim
Gina Abdelhalim el 19 de Jun. de 2020
Respondida: Anmol Dhiman el 23 de Jun. de 2020
Hi guys,
My line is:
title ( [ 'compare:' , (variable) ] )
The title is displayed correctly, but it is seprated into several lines because variable is a cell array.
Could someone help me with this please? :)
  1 comentario
Gina Abdelhalim
Gina Abdelhalim el 19 de Jun. de 2020
i should perhaps clarify that i want the title to be displayed in one line above the plot

Iniciar sesión para comentar.

Respuestas (1)

Anmol Dhiman
Anmol Dhiman el 23 de Jun. de 2020
Hi Gina,
You can use strcat for the above problem.
Assuming there are 2 elements in your cell array. You can use
title ( [ strcat('Compare: ', variable{1}, variable{2}) ] )
If there are more elements, you can write a script to generate a string and use it in title as shown below
titleString = "Compare :";
for i =1:numel(a)
titleString = strcat(str1, a{i});
end
title([titleString]);
where a is the input cell array.
Regards,
Anmol Dhiman

Etiquetas

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by