[Scilab-users] Odd behaviour with dos() function

Federico Miyara fmiyara at fceia.unr.edu.ar
Wed Jul 28 17:31:11 CEST 2021


Lester,

I don't know whether your post is related to my earlier message or it is 
just that we both have had the same problem.

Unfortunately the documentation isn't clear enough, for instance it says:

   commands
   Single text containing instructions sent to the MS Windows cmd.exe 
command interpreter.

but it doesn't say how the instructions should be connected. They could 
be separated by commas, by spaces, by semicolons... Seemingly it is by 
spaces (at least this way the bOK argumet is True), but there could be 
some ambiguity, for instance if one wants to change directory and the 
directory contains two words and the second is also a command or a program.

On the other hand the expression "single text" is not clear. What is a 
"text" in Scilab? Text is meaningless, in Scilab we have strings, and 
"single" is somewhat vague. Does it mean a one-component string?

Your workaround of using a batch may work, but it requires the extra job 
of creating and saving it and at the end deleting it, which should be 
automatic.

Regards,

Federico Miyara


On 28/07/2021 10:57, Lester Anderson wrote:
> Hello all,
>
> This has been queried previously without an obvious solution.
>
> For example: [output, bOK]=dos('grdinfo Test_10-FAA.grd')
> Fails with bOK = F
>
> Adding 'start grdinfo Test_10-FAA.grd gives bOK=T but now dos window 
> console with the result
>
> The only way to get the out put shown below is to put the commands 
> into a bathch  file:
> grd-info.bat (containing the command stream grdinfo Test_10-FAA.grd
>
> Such that the dos function becomes: [out,TF]=dos('start 
> grd-info.bat'); out, TF
>
> \D_Drive\Geoscience\Scilab>grdinfo Test_10-FAA.grd
> Test_10-FAA.grd: Title:
> Test_10-FAA.grd: Command: grdsample -R-10/10/-10/10 -I1m 
> @GMTAPI at -000001 -Gc:\Temp\Test_10-FAA.grd -fg --GMT_HISTORY=false
> Test_10-FAA.grd: Remark:
> Test_10-FAA.grd: Pixel node registration used [Geographic grid]
> Test_10-FAA.grd: Grid file format: nf = GMT netCDF format (32-bit 
> float), CF-1.7
> Test_10-FAA.grd: x_min: -10 x_max: 10 x_inc: 0.0166666666667 (1 min) 
> name: longitude n_columns: 1200
> Test_10-FAA.grd: y_min: -10 y_max: 10 y_inc: 0.0166666666667 (1 min) 
> name: latitude n_rows: 1200
> Test_10-FAA.grd: v_min: -104.96169281 v_max: 456.651062012 name: z
> Test_10-FAA.grd: scale_factor: 1 add_offset: 0
> Test_10-FAA.grd: format: netCDF-4 chunk_size: 134,134 shuffle: on 
> deflation_level: 3
>
> However, even with this workaround, nothing is written to the variable 
> 'out'. The program 'grdinfo' is in the Windows path, so should be run 
> without using start. In the past, the function did work. Basic Windows 
> commands like {out, TF]=dos('dir') works.
>
> I have verified that nothing is written to the consolebox. In 
> addition, this is a new computer and new install of Scilab 6.1.1
> Also, the same function under Octave runs correctly as dos('grdinfo 
> Test_10-FAA.grd'), and I am assuming the Scilab version should behave 
> the same.
>
> Since the mailinglists section is no longer functional, I cannot check 
> for possible solutions or pointers. Apologies if this is repeating my 
> previous query on the issue.
>
> Thanks
>
> Lester
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users



-- 
El software de antivirus Avast ha analizado este correo electrónico en busca de virus.
https://www.avast.com/antivirus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20210728/e6b40cdb/attachment.htm>


More information about the users mailing list