[Scilab-users] pfprintf, msscanf errors

Mathieu Dubois mathieu.dubois at limsi.fr
Tue Sep 4 21:45:59 CEST 2012


Hello,

I don't know if you still need help but I have some advice...

Le 29/08/2012 22:08, Steve Curtin a écrit :
> Hello All,
>
>
>   I have a question about formatted input and output which seems to fail
>   almost capriciously.
>
> For instance I have the following line in a program:
>
>    mfprintf(outf,'%f\t%f\n',var_a,var_b);
>
> and I sometimes (not not always) get the following error:
>
>                                                         !--error 998
>
> printf: Not enough arguments.
>
What is the content of var_a and var_b in case where it doesn't work?
Are they scalars? Vectors? Matrices?

> Likewise I’ve tested the following line in a small program, the
> following line works fine and reads all the variables
>
>                                  [numargs, var1, var2, var3, var4, var5,
> var6, var7, var8, var9, var10, var11, var12, var13, var14, var15, var16]...
>
>                                                  = msscanf(inline,'%s %s
> %s %d %d %d %f %f %f %f %d %f');
>
> but when I paste it into a bigger one I get the following:
>
> f(inline,'%s %s %s %d %d %d %f %f %f %f %d %f')
>
>                                                  !--error 207
>
> sscanf: Wrong type for argument 1: Matrix of strings expected.
>
This means that your "inline" variable is not a string matrix (type 
typeof(inline) to check). Also in which variables do you store the result?

> I’m more used to straight compiled C, is there another approach that
> works better for SciLab?
>
I usually use mfprinf and mfscanf for formatted I/O (because I use tools 
written in different langauges and text files are easy to read in any of 
them). From my humble experience it often takes a long time to debug I/O.

Scilab has binary I/O (see save and load) which may be convenient too. I 
think they are portable from one platform to another.


HTH,
Mathieu

> This is  on the Windows platform, I’m using 5.3.3. and the 5.4.0 beta2.
>
> Thanks, Steve
>
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>



More information about the users mailing list