Rotate Individual Letters in a String

3 visualizaciones (últimos 30 días)
Dima
Dima el 23 de En. de 2012
Hello! I wonder if there is a way to have the word SINE rotated 90% counter-clockwise and each of the letters 90% clockwise so that the letters stand normal on oneanother like:
E N I S
Thanks!

Respuesta aceptada

Jan
Jan el 24 de En. de 2012
Does this help:
S = 'SINE';
C = cell(1, numel(S));
for i = 1:numel(S)
C{i} = S(i);
end
% >> C = {'E', 'N', 'I', 'S'}
text(0.5, 0.5, C);
? I'm still not sure, what you want to achieve.
  1 comentario
Dima
Dima el 24 de En. de 2012
Brilliant!!!! this one worked! thanks so much!!))) can you please explain to me how this code works?
My aim is to place vertical text markers on MULTIPLE points in a chart so I used a code like this:
text(Num(7:end2,1)-1,Num(7:end2,77),'S1')
now I just replaced it to work in the for-end way:
for j=7:end2
text(j,Num(j,76),C,'FontSize',2,'Color','W','VerticalAlignment','middle','HorizontalAlignment','center','Rotation',0,'BackgroundColor',[1,0.4,0.6]);
end
and it works superb!!! I now just need to generate separate word strong for each point from
S = 'SINE';
C = cell(1, numel(S));
for i = 1:numel(S)
C{i} = S(i);
end

Iniciar sesión para comentar.

Más respuestas (3)

bym
bym el 23 de En. de 2012
t = 'sine'
flipud(t')
ans =
e
n
i
s
  2 comentarios
Dima
Dima el 23 de En. de 2012
thanks...but when I try to text the oputput of flipud(t') it gives the same error:
??? Error using ==> text
Each string specified must have a corresponding set of coordinates
bym
bym el 24 de En. de 2012
what are your x y arguments passed to text()?

Iniciar sesión para comentar.


Dima
Dima el 23 de En. de 2012

Dima
Dima el 23 de En. de 2012
I found a way to create the vertical string :
t1 = 'S'; t2 = 'I'; t3 = 'N'; t4 = 'E';
S1 = char(t1, t2, t3);
But when I try to text this string I get the following error:
??? Error using ==> text
Each string specified must have a corresponding set of coordinates
I wonder what is the reason for this error?
Thanks!
  4 comentarios
Walter Roberson
Walter Roberson el 23 de En. de 2012
char() with multiple single-character arguments turns out to do vertical cat anyhow.
Dima
Dima el 24 de En. de 2012
you think it is impossible to rotate the text in this way with no function whatsoever?

Iniciar sesión para comentar.

Categorías

Más información sobre Cell Arrays en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by