Reply by March 17, 20052005-03-17
As Tim wrote, fprintf is the function to use. You'd had to write your own 
script, though (but that's not too complicated)

-- 
------------------------------
Jaime Andr�s Aranguren Cardona
jaac@sanjaac.com
SanJaaC Electronics
Soluciones en DSP
www.sanjaac.com


"Pasi" <pasi@pa.si> escribi&#4294967295; en el mensaje 
news:d1a8v5$7n9$1@plaza.suomi.net...
> Tim Wescott wrote: >> Pasi wrote: >> >>> Hi! >>> >>> How can I c+p matlab arrays (very large) to c code? Can I write it to >>> some file in matlab? Like: >>> >>> in matlab >>> --- >>> >> S=[1 2 3 4 5;2 3 4 5 6] >>> >>> S = >>> >>> 1 2 3 4 5 >>> 2 3 4 5 6 >>> --- >>> >>> In c: >>> --- >>> int S[2][5] ={ >>> {1, 2, 3, 4, 5}, >>> {2, 3, 4, 5, 6} >>> }; >>> --- >>> >>> If I c+p directly this text from matlab to c code, I have very much to >>> the doing. >> >> >> "c+p"? >> > > Copy and paste.
Reply by Bhaskar Thiagarajan March 16, 20052005-03-16
"Pasi" <pasi@pa.si> wrote in message news:d1a7pr$6fq$2@plaza.suomi.net...
> Hi! > > How can I c+p matlab arrays (very large) to c code? Can I write it to > some file in matlab? Like:
Pray tell what 'c+p' is?
> in matlab > --- > >> S=[1 2 3 4 5;2 3 4 5 6] > > S = > > 1 2 3 4 5 > 2 3 4 5 6 > --- > > In c: > --- > int S[2][5] ={ > {1, 2, 3, 4, 5}, > {2, 3, 4, 5, 6} > }; > --- > > If I c+p directly this text from matlab to c code, I have very much to > the doing.
Well, you can open a file pointer in matlab, use fprintf (and its variants) to write to the file in a form that is suitable for C. Look up fopen, fprintf in the matlab help files for details. You should also be asking this in the matlab newsgroup (perhaps only there). comp.soft-sys.matlab Cheers Bhaskar
Reply by Pasi March 16, 20052005-03-16
Tim Wescott wrote:
> Pasi wrote: > >> Hi! >> >> How can I c+p matlab arrays (very large) to c code? Can I write it to >> some file in matlab? Like: >> >> in matlab >> --- >> >> S=[1 2 3 4 5;2 3 4 5 6] >> >> S = >> >> 1 2 3 4 5 >> 2 3 4 5 6 >> --- >> >> In c: >> --- >> int S[2][5] ={ >> {1, 2, 3, 4, 5}, >> {2, 3, 4, 5, 6} >> }; >> --- >> >> If I c+p directly this text from matlab to c code, I have very much to >> the doing. > > > "c+p"? >
Copy and paste.
Reply by Tim Wescott March 16, 20052005-03-16
Pasi wrote:

> Hi! > > How can I c+p matlab arrays (very large) to c code? Can I write it to > some file in matlab? Like: > > in matlab > --- > >> S=[1 2 3 4 5;2 3 4 5 6] > > S = > > 1 2 3 4 5 > 2 3 4 5 6 > --- > > In c: > --- > int S[2][5] ={ > {1, 2, 3, 4, 5}, > {2, 3, 4, 5, 6} > }; > --- > > If I c+p directly this text from matlab to c code, I have very much to > the doing.
"c+p"? Look to see what kind of formatted printing facilities Matlab has -- it'll probably be named "printf" or "fprintf" and you should be able to output in whatever language you want. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com
Reply by Pasi March 16, 20052005-03-16
Hi!

How can I c+p matlab arrays (very large) to c code? Can I write it to 
some file in matlab? Like:

in matlab
---
 >> S=[1 2 3 4 5;2 3 4 5 6]

S =

      1     2     3     4     5
      2     3     4     5     6
---

In c:
---
int S[2][5] ={
{1, 2, 3, 4, 5},
{2, 3, 4, 5, 6}
};
---

If I c+p directly this text from matlab to c code, I have very much to 
the doing.