From: Sören Sieberling on
Hello,

Could someone tell me how I can print this using fprintf, I probably missed an insturction somewhere:

DE = [ 0.5000 0.7000 0.9000; 2.0000 3.0000 4.0000 ]; > CHECK)

With A = 0.5 0.7 0.9 and B 2 3 4

using fprintf in one line. Right now this is what I do:

fid = fopen ('test.txt', 'w');

fprintf(fid,'DE = [ ')
fprintf(fid,'%6.4f',A)
fprintf(fid,'; ')
fprintf(fid,'%6.4f',B)
fprintf(fid,' ]; > CHECK)')

fclose(fid);

Seems kind of exaggerated. I was hoping to end up with something like:

fid = fopen ('test.param', 'w');
fprintf(fid,'DE = [ % 6.4f ; % 6.4f ] > lookupTable_BUS)' , A, B)
fclose(fid);

But this doesn't work.

Thanks,
Soeren
From: Sean on
"Sören Sieberling" <seuren83(a)hotmail.com> wrote in message <i0i9nf$hnj$1(a)fred.mathworks.com>...
> Hello,
>
> Could someone tell me how I can print this using fprintf, I probably missed an insturction somewhere:
>
> DE = [ 0.5000 0.7000 0.9000; 2.0000 3.0000 4.0000 ]; > CHECK)
>
> With A = 0.5 0.7 0.9 and B 2 3 4
>
> using fprintf in one line. Right now this is what I do:
>
> fid = fopen ('test.txt', 'w');
>
> fprintf(fid,'DE = [ ')
> fprintf(fid,'%6.4f',A)
> fprintf(fid,'; ')
> fprintf(fid,'%6.4f',B)
> fprintf(fid,' ]; > CHECK)')
>
> fclose(fid);



%DE = [ 0.5000 0.7000 0.9000; 2.0000 3.0000 4.0000 ]; > CHECK)

A = [0.5, 0.7, 0.9];
B = [2, 3, 4];

fid = fopen('test4Soren.txt', 'w');

fprintf(fid,['DE = [' sprintf(' %6.4f',A) ';' sprintf(' %6.4f',B) ']; > CHECK)'])

fclose(fid);
From: Sören Sieberling on
Hey Sean,

Thanks.
 | 
Pages: 1
Prev: append
Next: more surface fitting