[Scilab-users] My Scilab 6.1.0 desktop crashes on this line

2021-03-22 Thread Jan-Åge Langeland
I kept getting some crashes, and found it to be caused by a line that can be stripped down to this: disp(ascii(13)+"a;") Is there a logical explanation? Jan ___ users mailing list users@lists.scilab.org

Re: [Scilab-users] Read file (.txt)

2020-09-10 Thread Jan Åge Langeland
The main problem I ran into with csvRead was reading files with a variable number of separators in each row. Then my suggested solution pads with 0. It could be changed to pad with NaN also. Using strsplit in each row allows for several separators in the same conversion.  It may still be

Re: [Scilab-users] Read file (.txt)

2020-09-09 Thread Jan Åge Langeland
Hi Daniel I made my own csvread, it seems to read your file OK with exec('JcsvRead3.sce', -1); M=JcsvRead3('output.txt','   '); Brgds Jan On 2020-09-10 0:03 AM, Daniel Stringari wrote: Good evening everyone, I'm integrating scilab with other software, so I need to read an output file

Re: [Scilab-users] CsvRead function

2020-05-13 Thread Jan Åge Langeland
One thing I find is that csvRead does not seem to extract data correctly in 6.1.0 with "  " (double space) as separator. test4.csv 11 2 3 4 11 21 3 41 6.1.0 csvRead("test4.csv","  ")  ans  =    Nan   Nan   Nan   4.    Nan   Nan   Nan   41. 6.0.2  csvRead("test4.csv","  ")  ans 

Re: [Scilab-users] CsvRead function

2020-05-12 Thread Jan Åge Langeland
csvRead is quite strict regarding column structure etc, but the associated error message is typical "can not read..". So when it reports "does not exist", it looks like the file is missing, or misplaced. If you still think the file is there, you may try this script that I have used to

Re: [Scilab-users] [EXT] parsing TSV (or CSV) file with scilab

2020-04-28 Thread Jan Åge Langeland
I find it safer to process the data without returning to a disk file. As mentioned I actually prefer to start with mgeti() and read the file as binary, as then all byte values are accepted. But anyway with the data separated in lines, it is relatively simple to split up with the wanted

Re: [Scilab-users] parsing TSV (or CSV) file with scilab is a nightmare

2020-04-27 Thread Jan Åge Langeland
Antoine To find out how long the file is (although not strictly necessary) I normally use: fid = mopen(datafile,'rb'); mseek(0,fid,'end'); lef=mtell(fid) mseek(0,fid); Then you can read in the whole file byte by byte (or split it up if it is big) : data=mgeti(lef,'c',fid); The rest is

Re: [Scilab-users] printf "\r" in Scilab 6x

2020-04-10 Thread Jan Åge Langeland
In 6.0.2 I find I need to use: for i = 1:12, mprintf("Progress = %d\n\n\n", i); sleep(2000); clc(1); end JÅ On 2020-04-10 10:50 AM, Rafael Guerra wrote: for i = 1:12, mprintf("Progress = %d\n\n", i); sleep(2000); clc(0); end ___ users mailing list

Re: [Scilab-users] Context error in Xcos Scilab 6.1.0

2020-03-04 Thread Jan Åge Langeland
Yes! Thank you. JÅ On 2020-03-04 0:48 AM, Chin Luh Tan wrote: hi, sorry to interrupt half way to just give some idea, have you tried to right click on the Scilab and run it as administrator? I was facing similar issue on write access even I am the admin for win10, local acc, but still I

Re: [Scilab-users] Bitget for int64/uint64

2020-02-28 Thread Jan Åge Langeland
Thank you Samuel For some reason I get an error message : --> genlib elementary_functionslib genlib: Cannot open file ''C:\Program Files\scilab-6.1.0\modules\elementary_functions\macros\lib''.  ans  =  F Although scinotes("lib") opens the file, so it is there. Anyway, this works fine: -->

Re: [Scilab-users] Bitget for int64/uint64

2020-02-27 Thread Jan Åge Langeland
Thank you, Stéphane So a workaround is: b  =uint64(2)^61+1 bb2=uint64(bin2dec(strsplit(strrev(bitstring(b'); bb1=bitget(b,1:64); bb2(1)-bb1(1)  ans  =  1 A bit of a waste to use uint64 to store single bits, but that is what bitget does: --> typeof(bb1)  ans  =  "uint64" Jan On

Re: [Scilab-users] find name / path of open file

2019-12-27 Thread Jan Åge Langeland
Federico Yes, I thought that would be easier. But still not as good as it could be, as it is difficult to use these function calls directly in expressions. This is the way I think it should be done in Scilab 6: function fp=fparts(fid) [a,b,fpne,d,e]=file(fid);

Re: [Scilab-users] find name / path of open file

2019-12-27 Thread Jan Åge Langeland
[u,t,pathandfilename]=file(fd) Jan On 2019-12-27 7:54 AM, Federico Miyara wrote: Dear All, How can I find the path and name of an open file from its file descriptor provided by mopen? Thanks, Federico Miyara ___ users mailing list

Re: [Scilab-users] designing a sound file

2019-12-21 Thread Jan Åge Langeland
I am not really an expert in this format, but unless you want a very long file, the logical approach for me would be to make a vector with zeros representing all samples, then insert the imported tick and tack samples at the right places, and export to a file with wavewrite or savewave. Making

Re: [Scilab-users] 3 byte integers

2019-12-18 Thread Jan Åge Langeland
As a quick fix, would it work to use a temporary file for the data you want to append?  Something like this wavwrite(wavdata_24,'temp') f1=mopen('temp.wav'.,'rb') wavdata_bytes=mget(n_bytes,'c',f1) f2=mopen('main.wav','ab') mput(wavdata_bytes(45:n_bytes),'c',f2) Brgds Jan On 2019-12-18

Re: [Scilab-users] Can't Find the Error

2017-12-02 Thread Jan Åge Langeland
On 30.11.2017 20:35, rentboi wrote: Hey everyone I kept on trying to find out what the error is in the code below, Apparently your data are not separated by ascii(9) - tab. Anyway, If you just want the numbers: temp2=strtod(csvRead("filename", ascii(13),'.','string',[',' ' '])(2:($-1)));

Re: [Scilab-users] Find the error -line length

2017-11-29 Thread Jan Åge Langeland
On 28.11.2017 18:58, Rafael Guerra wrote: In Win7 Scilab 6.0.0 it only worked with Jan's recommendation (replacing -999 to -9), with or without header. The original file seems to have numeric data lines with total number of characters varying from 3270 to 4172 per row. There must be a

Re: [Scilab-users] Find the error -line length

2017-11-28 Thread Jan Åge Langeland
On 28.11.2017 17:53, Jan Åge Langeland wrote: On 28.11.2017 15:30, Richard llom wrote: Hello, when trying to read in this file: ftp://ftp-cdc.dwd.de/pub/CDC/grids_germany/monthly/radiation_direct/grids_germany_monthly_radiation_direct_201706.zip with: M = fscanfMat

Re: [Scilab-users] Find the error

2017-11-28 Thread Jan Åge Langeland
On 28.11.2017 15:30, Richard llom wrote: Hello, when trying to read in this file: ftp://ftp-cdc.dwd.de/pub/CDC/grids_germany/monthly/radiation_direct/grids_germany_monthly_radiation_direct_201706.zip with: M = fscanfMat('grids_germany_monthly_radiation_direct_201706.asc') I'm getting an error

Re: [Scilab-users] Weird things with the continuation dots

2017-11-09 Thread Jan Åge Langeland
In text documents it is good practice to use … (U+2026) rather than ... . Some text editors (Open Office at least) even quietly autocorrect it. Should it be allowed in Scilab? Jan ___ users mailing list users@lists.scilab.org

Re: [Scilab-users] How to read in date & time ?

2017-11-07 Thread Jan Åge Langeland
Hello Assuming you have two header lines in your files, try this: tt=csvRead(log_file,";",[],"double",[".",";";":",";";",",";"],[],[],2) tv=datenum(tt(:,3),tt(:,2),tt(:,1),tt(:,4),tt(:,5),0) td=datevec(tv) Jan On 07.11.2017 15:38, Richard llom wrote: Hello, I have logfiles in the

Re: [Scilab-users] xselect () from previous versions of scilab

2017-09-13 Thread Jan Åge Langeland
On 13.09.2017 08:05, Hermes wrote: Hello, What is the function in scilab 6.00 that replaces xselect () from previous versions of scilab? Have a good day Gracias Hermes show_window() ? J ___ users mailing list users@lists.scilab.org

Re: [Scilab-users] {EXT} Handling of special characters like °

2017-05-29 Thread Jan Åge Langeland
Thank you all for for comments You may want to comment in the bug report: http://bugzilla.scilab.org/show_bug.cgi?id=15172 Jan ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users

Re: [Scilab-users] {EXT} Handling of special characters like °

2017-05-29 Thread Jan Åge Langeland
On 29.05.2017 10:15, Dang Ngoc Chan, Christophe wrote: Hello, De : users [mailto:users-boun...@lists.scilab.org] De la part de JLan Envoyé : samedi 27 mai 2017 10:21 Is there a good explanation for this behavior? [...] --> d=ascii('°') d = 194. 176. I've got the same behaviour here

Re: [Scilab-users] mixed data type matrix

2017-03-23 Thread Jan Åge Langeland
On 23.03.2017 09:54, fujimoto2005 wrote: I want to make the matrix whose the first column has the date value such as 2007/5/1 which I can use it in Excel and whose second column has the numerical value such as 0.12. How can I construct such mixed data type matrix which I can copy it and paste

Re: [Scilab-users] Reading numerical and string vectors from txt-file

2017-03-22 Thread Jan Åge Langeland
On 22.03.2017 14:49, Jens Simon Strom wrote: Would you get to BAThour and BATminute the same way? I would probably have done it in a more complicated way:-), but I like this solution, it seems quite robust for characters replacing missing numbers. In case your number of header lines

Re: [Scilab-users] How to print int64 or uint64 integers at full accuracy?

2016-08-29 Thread Jan Åge Langeland
On 29.08.2016 02:09, Tim Wescott wrote: A kludge would be to make it into two integers. Each case may not be so complex to work around, but in total it seems like Scilab 6 is not yet well prepared for int64 and uint64. For instance %x and %o need to be handled too, functions like dec2bin()

Re: [Scilab-users] Regex problem

2016-08-28 Thread Jan Åge Langeland
Very good, a way of using logical operators that I was not aware of. Even this seems to works: data(data<32|data>127)=ascii(".") Thank you also Samuel for fixing the mgeti('l') bug. Both will help me a lot in reading and decoding some large seismic files. Jan Å On 28.08.2016 06:20, Samuel

Re: [Scilab-users] Regex problem

2016-08-26 Thread Jan Åge Langeland
Gerhard Would this work? Read as much as you need as binary and convert the non ascii values to an ascii value, for instance 0. The below is not optimized, and I have no idea why the strsplit is needed, but I got an "unknown error" without it: fid=mopen(datafile,"rb"); btr=1000;

Re: [Scilab-users] plot2d problem

2016-08-24 Thread Jan Åge Langeland
plot2d(x,[y' z'])// ? Jan Å On 24.08.2016 16:00, philippe wrote: Hi, Le 21/08/2016 à 08:27, Gerhard Kreuzer a écrit : here my two attepts one working, one failed, but why? plot2d(x, [y z]); //plot2d(x, y);// working //plot2d(x, z);// working

Re: [Scilab-users] {EXT} create random values between [-1,1]

2016-06-10 Thread Jan Åge Langeland
I suggest a normal distribution: histplot(10,10+grand(1,1000,"nor",0,.01)) Jan Å On 10.06.2016 16:41, Dang Ngoc Chan, Christophe wrote: Hello, De : De la part de Dang Ngoc Chan, Christophe Envoyé : vendredi 10 juin 2016 15:38 AFAIK, the sum of two random values following a normal Reading

Re: [Scilab-users] Restoration error (5.2.2-64bit)

2016-04-25 Thread Jan Åge Langeland
Have you tried to delete your configuration files? Could be here: C:\Users\NN\AppData\Roaming\Scilab Jan Å On 25.04.2016 21:13, kjubo wrote: Dear all, I encourted a weird problem. After starting to use external monitor with my notebook, Scilab stopped to work. I get error messages

Re: [Scilab-users] Executing scripts with functions from GUI

2016-04-18 Thread Jan Åge Langeland
On 18.04.2016 21:05, Samuel Gougeon wrote: afun() is defined in sel(), and so is local to sel(). It is cleared when leaving sel(). To prevent this, you may return it as "afun" in the environment calling sel() with: afun = return(afun) at the end of sel(), before leaving it.

Re: [Scilab-users] the name of a script

2016-03-19 Thread Jan Åge Langeland
On 16.03.2016 15:59, fujimoto2005 wrote: Hi,all I executed the script with the execute command of the scinote so it failed. I want to use the execute command of the scinote. I tried [units,typs,nams]=file(). But nams are as follows stderr ! ! ! !C:\***\gettingScriptName02.sce ! ! ! !stdin

Re: [Scilab-users] the name of a script

2016-03-16 Thread Jan Åge Langeland
On 16.03.2016 10:11, fujimoto2005 wrote: Hi,JLAN Thanks for your reply. Your code return only "// -- 16/03/2016 18:04:51 -- //" as a. I execute the script containing the following lines with the script name ''gettingSscriptName.sce' clear; a=gethistory(); b=strsplit(a($),

Re: [Scilab-users] plot bug in scilab 6.0 beta1

2016-03-02 Thread Jan Åge Langeland
On 02.03.2016 10:23, antoine.monmayr...@laas.fr wrote: Hi all, I found a bug in scilab 6.0 beta1. Plot seems to fail for some curves when trying to specify a color different than the default one: It works OK for me with Windows 10 and 6.0 beta 1, I can plot any color. But I get a

Re: [Scilab-users] mprintf and backspace

2016-02-26 Thread Jan Åge Langeland
ref. the somewhat related bug report: http://bugzilla.scilab.org/show_bug.cgi?id=14342 Jan Å ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users

Re: [Scilab-users] Scilab 6.0.0 Beta crashed by input()

2016-02-18 Thread Jan Åge Langeland
On 18.02.2016 08:47, Antoine Monmayrant wrote: Le 02/17/2016 05:10 PM, JLan a écrit : Is this just on my machine? Saddly, no! I just tried it on my machine (linux ubuntu 14.04 64bits) and bye bye scilab. Could you report a bug ? Antoine Thank you Antoine

Re: [Scilab-users] News: Scilab 6 Beta, VISA Toolbox, Embedded World 2016

2016-02-16 Thread Jan Åge Langeland
On 16.02.2016 11:55, Eric Dubois wrote: Don’t other Scilab users share my concern? Regards Éric. I have a similar (but simpler) problem, with stacksize(). All my old scripts containing stacksize('max') etc. need to be modified. All it will take is to keep the standard function

Re: [Scilab-users] ?==?utf-8?q? Put an image as the background of an axis

2016-02-11 Thread Jan-Åge Langeland
The only added bonus with the uicontrol is that you have access to a callback function to react to the user's action. Not even: as for the text style (http://bugzilla.scilab.org/7111), the callback is not implemented for the image style. After your example, add: h.callback_type=0; h.callback

Re: [Scilab-users] ?= Put an image as the background of an axi

2016-02-11 Thread Jan Åge Langeland
On 11.02.2016 20:14, Samuel Gougeon wrote: Le 11/02/2016 12:01, Jan-Åge Langeland a écrit : .../... I would really like to get the cursor position in the callback, like I do with xclick(), so clicking on different part of the image can work like a menu (Samuel?): Why not putting xclick

Re: [Scilab-users] ?= Put an image as the background of an axi

2016-02-11 Thread Jan-Åge Langeland
What would a callback bring anyway, that you cannot do with xclick() ? Well, callbacks are the "official" way of interacting with the user. It would allow you to create an intereface in a consistant way, using only callbacks. Antoine Well you can put the image on top of a button:

Re: [Scilab-users] ?==?utf-8?q? Put an image as the background of an axis

2016-02-10 Thread Jan Åge Langeland
On 10.02.2016 09:19, Antoine Monmayrant wrote: f = gcf(); imageWidth = 181; imageHeight = 144; f.axes_size=[imageWidth,imageHeight]; //here image parent can be set to something else than the figure f (like a frame, ...) h = uicontrol("Parent", f, .. "Style", "image", .. "Position", [0 0

Re: [Scilab-users] Put an image as the background of an axis

2016-02-09 Thread Jan Åge Langeland
On 09.02.2016 20:27, Samuel Gougeon wrote: You may use the z coordinate of your flat curves to manage overlays, as in: clf x = linspace(0,20,200); plot(x,sin(x)) e = gce(); c = e.children; // Example with a local image. The image is from https://atoms.scilab.org/atoms.png

Re: [Scilab-users] Put an image as the background of an axis

2016-02-08 Thread Jan Åge Langeland
On 08.02.2016 11:47, antoine.monmayr...@laas.fr wrote: Hi everyone, I just failed at placing an image behind a plot. I thought that would be easy: - create a figure - create an image uicontrol - create an axis - plot in the axis - set axis.filled="off" Apparently I was

Re: [Scilab-users] Logical zero

2016-02-02 Thread Jan Åge Langeland
On 01.02.2016 17:43, Dang Ngoc Chan, Christophe wrote: Hello, De : Jan-Åge Langeland Envoyé : lundi 1 février 2016 14:41 I ran a little speed test with the different alternatives, I found the results surprising: These kind of tests are of course interesting, but I'm always suspicious

Re: [Scilab-users] Logical zero

2016-02-01 Thread Jan-Åge Langeland
I ran a little speed test with the different alternatives, I found the results surprising: Jan //script ftest.sce m=1 n=1 v=ver(); disp(v(1,1:2)); clear a; timer(); a = zeros(n, m) == 1; //best in Scilab 6.0.0 disp(timer()); clear a; timer(); a=zeros(n,m)>0; disp(timer()); clear a;

Re: [Scilab-users] Logical zero

2016-02-01 Thread Jan-Åge Langeland
I forgot to test a=~ones(n,m). I guess this is the overall winner (from Stéphane Mottelet): Scilab 5.5.1: 0.2964019 Scilab 6.0.0: 0.5616036 Jan ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users

Re: [Scilab-users] Accessing the nth output of a function

2016-01-10 Thread Jan Åge Langeland
It may not solve your problem, but in Scilab 6 you can at least access the nth element of the first output argument. --> function c=a(b) > c(1)=b > c(2)=b^2 > c(3)= b^3 > endfunction --> a(2)(2) ans =4. Another solution could be like it is done in size(), where an extra input

Re: [Scilab-users] Scilab conversion of Matlab code - query

2016-01-06 Thread Jan Åge Langeland
The original code seems to run with the small change(note the ' ): flex(:,1) = dist'; JÅ On 06.01.2016 11:54, Lester Anderson wrote: Hello, A basic query, but I cannot seem to get the Scilab code to run as it should and plot the data. Not sure where it is falling over. Attached the code

Re: [Scilab-users] Plotting curves against a set of points

2015-12-22 Thread Jan Åge Langeland
Have you tried plot() and replot()? You can do quite a bit with that by using LineSpec and GlobalProperty. The example below includes plotting with primary and secondary Y axis: Jan clf; t=1:100; x=t.^2/100; y=[4,12,32,72,95]; z=[500,1100,2100,4100,5000]; replot([t(1),ceil(t($)); 0, 120]);

Re: [Scilab-users] Is this a known bug?

2015-12-21 Thread Jan Åge Langeland
I tried to run your function in Windows 10. Memory usage climbs gradually here also, but when it reaches 90% some action is taken, and it drops to about 85%. This goes on repeatedly, so I have not yet observed a crash or major slow-down. Jan On 21.12.2015 06:37, Tim Wescott wrote: I'm

Re: [Scilab-users] getting the first column number of each row

2015-11-30 Thread Jan-Åge Langeland
[a y]=max(int8(x>.5),'c'); JÅ On 30.11.2015 06:54, fujimoto2005 wrote: I want to get the first column number of each row with %T. Now I use loop as follows. x=rand(10,10); for i=1 :10 y(i)=min(find(x(i,:)>0.5); end Is there any way to get y without using 'for end' loop because it

Re: [Scilab-users] long legend

2015-11-14 Thread Jan Åge Langeland
Smart solution from Rafael Guera, I actually needed the same . Here an inspired alternative with plot(), that also gets the colors correct (on white background): x=1:0.1:6; y1=sin(x); y2=cos(x); str="This is a very long legend. Vive la France"; str1= part(str,1:27); str2= part(str,28:$);