Hi. When I wish to copy results from Matlab into a LyX document I
generate a tab-delimited string and then paste it into a LyX table.

For example,in Matlab I might have a cell of results like:
test = {'A' 'dog' 200; 'B' 'cat' 99.3}
which looks like
test =

   'A'    'dog'    [200]
   'B'    'cat'    [99.3]

If I convert this to a string by substituting new cells by tab
character sprintf('\t') and newlines by sprintf('\t') I get something
like:
str =

A dog 200.0000
B cat 99.3000

Using the Matlab command clipboard('copy',str) this can easily be
pasted into a LyX table using Ctrl+Shft+V, or "Plain Text, Join
Lines".  This is a nice, easy way to generate tables of results...

...however, this pastes the contents into the LyX table as text only.
Is there a way of pasting cells where some of them are in math mode?
For instance, what if I have the matlab cell:
test = {'\alpha' 'dog' 200; '\beta' 'cat' 99.3}
I wish to paste this into a LyX table where the cells \alpha and \beta
and the numbers are not pasted as text, but as math (i.e. as greek
letters)?  Is there an easy way to do this? Adding $...$ around data
does not change the behaviour when pasted.

I would guess there is some way of formatting the copied string so
that LyX knows when to swap into and out of math mode.  This obviously
happens when one copies and pastes tables within LyX.  But I need help
trying to add this to the text string which I generate in Matlab and
paste in LyX.  Any ideas?

Thanks,
Ken

Reply via email to