From: Hans on 18 Jan 2010 02:02 Hello everybody How can I get sprintf to a write a string in latex? Example: y_1=[1 2 3 4] sprintf('%.0f \alpha\n', y_1) It must be a string output Best Regards Hans
From: kinor on 18 Jan 2010 02:41 "Hans " <jyde_6(a)msn.com> wrote in message <hj111c$ego$1(a)fred.mathworks.com>... > Hello everybody > > > How can I get sprintf to a write a string in latex? > > Example: > > y_1=[1 2 3 4] > sprintf('%.0f \alpha\n', y_1) > > It must be a string output > > Best Regards > > Hans Hi Hans, hope sprintf('%.0f \\alpha\n', y_1) does it kinor
From: Bruno Luong on 18 Jan 2010 02:44 "Hans " <jyde_6(a)msn.com> wrote in message <hj111c$ego$1(a)fred.mathworks.com>... > Hello everybody > > > How can I get sprintf to a write a string in latex? > > Example: > > y_1=[1 2 3 4] > sprintf('%.0f \alpha\n', y_1) > Replace \ with \\ Bruno
From: Hans on 18 Jan 2010 05:04 "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hj13g3$k23$1(a)fred.mathworks.com>... > "Hans " <jyde_6(a)msn.com> wrote in message <hj111c$ego$1(a)fred.mathworks.com>... > > Hello everybody > > > > > > How can I get sprintf to a write a string in latex? > > > > Example: > > > > y_1=[1 2 3 4] > > sprintf('%.0f \alpha\n', y_1) > > > > Replace \ with \\ > > Bruno Hi Bruno and kinor If I try: y_1=[1 2 3 4] sprintf('%.0f \\alpha\n', y_1) I get : >> sprintf('%.0f \\alpha\n', y_1) ans = 1 \alpha 2 \alpha 3 \alpha 4 \alpha I want it to show the alpha in symbol? Best Regards Hans
From: Bruno Luong on 18 Jan 2010 05:53
"Hans " <jyde_6(a)msn.com> wrote in message <hj1bmj$9an$1(a)fred.mathworks.com>... > "Bruno Luong" <b.luong(a)fogale.findmycountry> wrote in message <hj13g3$k23$1(a)fred.mathworks.com>... > > "Hans " <jyde_6(a)msn.com> wrote in message <hj111c$ego$1(a)fred.mathworks.com>... > > > Hello everybody > > > > > > > > > How can I get sprintf to a write a string in latex? > > > > > > Example: > > > > > > y_1=[1 2 3 4] > > > sprintf('%.0f \alpha\n', y_1) > > > > > > > Replace \ with \\ > > > > Bruno > > Hi Bruno and kinor > > If I try: > > y_1=[1 2 3 4] > sprintf('%.0f \\alpha\n', y_1) > > I get : > >> sprintf('%.0f \\alpha\n', y_1) > > ans = > > 1 \alpha > 2 \alpha > 3 \alpha > 4 \alpha > > I want it to show the alpha in symbol? You confuse, sprintf format the simple *string* (char array), the TeX/LaTex interpretation come later, when the string is used in graphic command such as XLABEL, TITLE... Bruno |