[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
http://lists.scilab.org/mailman/listinfo/users


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 useful to use evstr row by row instead, if 
the number of spaces between numbers vary.


J


On 2020-09-10 10:46 AM, P M wrote:

I think csvRead is just fine.

[data  header]  =  csvRead(fname,  '',  '.',  'string',  [],  [],  [],  0);
As you may notice the data Matrix contains a lot of empty columns.
This is due to the many white spaces in the text file
anyways, after reading the dta in you may use evstr() to convert into 
doubles.

BR
Philipp

Am Do., 10. Sept. 2020 um 04:03 Uhr schrieb 
>:


Hello Daniel,

Do you have try with "evstr" function ?

data = evstr(mgetl("output.txt"));

Regards,
Antoine

___
users mailing list
users@lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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
(.txt), like the one attached (output).

It is worth mentioning that this file does not always have the same
dimensions (matrix), so I am trying to find something robust that can deal
with this particularity. I tried to use the 'csvread' function and the
'read' function, but I still haven't been successful ... Any suggestions?

output.txt 





--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

//Read CSV file -JÅ 2020
function M=JcsvRead3(filename,varargin)

linestoread=-1;// -1 for all, argument 6
headerlines=0;//argument 7
footerlines=0;//argument 8
   
separator=";"//default, can be changed by argument 2. Several separators 
accepted
decimal="."; //default, can be changed to , by argument 3
num_asc="double" // default , can be changed to "ascii" by argument 4

if argn(2)>1 
t1=type(varargin(1));
if t1==10 then 
separator=varargin(1);
else
mprintf("Default separator\n")
end
end
if argn(2)>2 
t2=type(varargin(2));
if t2==10 && varargin(2)=="," then 
decimal="," 
elseif t2>0 && varargin(2)~="."
mprintf("Decimal, select . or, \n");
err=return(varargin(2)) ;
end;
end
if argn(2)>3 
t3=type(varargin(3));
if  t3>0 then num_asc=varargin(3) end;
end
if argn(2)>6 
t6=type(varargin(6));
if  t6>0 && varargin(6)~=[] then linestoread=varargin(6) end;
end
if argn(2)>7 
t7=type(varargin(7));
if  t7>0 && varargin(7)~=[] then headerlines=varargin(7) end;
end
if argn(2)>8
t8=type(varargin(8));
if  t8==1 && varargin(8)~=[] then footerlines=varargin(8) end;
end
fid = mopen(filename,'rt');
csvline=mgetl(fid,linestoread);
mclose(fid);
n=size(csvline,1);
select num_asc;
case "double" then
M(1)=1;
for k=headerlines+1:n-footerlines
datatemp=strtod(strsplit(csvline(k),separator),decimal);
M(k-headerlines,1:length(datatemp))=datatemp';
end
case "string" then
M(1)=" "
for k=headerlines+1:n-footerlines
datatemp=strsplit(csvline(k),separator);
datatemp2=datatemp
M((k-headerlines),1:size(datatemp',2))=datatemp';
end
else
mprintf("Conversion double or string\n")
err=return(num_asc);
end
endfunction

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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  =

   11.   2.    3.   4.
   11.   21.   3.   41.

Jan

On 2020-05-13 10:46 AM, Daniel Stringari wrote:

Good Morning,

I'll post snippets of the code in question. Thanks for the effort Jan, the
detail is that no matter how much the file exists when the code is run, the
same file is deleted at the beginning by the MDELETE function, afterwards
the code itself tries to create it again. This happens because this code
aims to extract data from a specific software and that is why I ended up not
sending the whole code at the beginning, considering that you would not be
able to run it without some repairs.

Daniel.

https://drive.google.com/open?id=1TFWO1RrEsF9SkrBAFUC3DPu6Mmanaapn




--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 check csv files:


//Read CSV file -JÅ 2020
datafile="test.csv";
separators=[ascii(9),";"];
decimal=",";
headerlines=2;
linestoread=-1;// -1 for all
footerlines=2;
fid  =  mopen(datafile,'rb');
csvline=mgetl(fid,linestoread);
mclose(fid);
clear  dataset;
n=size(csvline,1);
for  k=1:n
if  k>headerlines  &&  k
Good Morning,

The file exists ... Every time the code is run, it tries to create a 
series of files inside the address "C: \ Temp \ PGC \ ..." using the 
functions FULLFILE, CSVWRITE, CSVREAD and MDELETE to create and 
manipulate the data. This tool always worked in version 6.0.2 and when 
upgrading to version 6.1, it started to give an error with the code 
identical to the previous version, so my first suspicion was in 
relation to the mentioned functions.




___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 separators and decimal sign :


clear  dataset;
headerlines=3:
footerlines=2:
for  k=1:size(in_text,1)
if  k>headerlines  &&  k

Antoine,

One workflow that works fast for me, for large data files, is to load 
first the whole file with mgetl, then remove all empty lines using 
isempty in a loop (as shown below), process the header block, isolate 
the data block and save it to a temporary backup file to disk using 
mputl, then load very efficiently from disk that backup file using 
fscanfMat.


tlines=mgetl(fid,-1); /// reads lines until end of file into 1 column 
text vector/


bool=~cellfun(isempty,tlines);

tlines=tlines(bool); /// removes empty lines/

function*out_text*=_cellfun_(*fun*, *in_text*)

/// Applies function to input text (column strings vector), line by line/

n=size(*in_text*,1);

for i=1:n;

*out_text*(i)=*fun*(*in_text*(i));

end

endfunction

Regards,

Rafael


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 just looking for the different letters and sort based on that.

Jan


On 2020-04-27 17:40 PM, Antoine Monmayrant wrote:


Hi all,


This is both a rant and desperate cry for help.
I'm trying to parse some TSV data (tab separated data file) with 
scilab and I cannot find a way to navigate around the minefield of 
bugs present in meof/mgetl/mgetstr/csvRead.


A bit of context: I need to load into scilab data generated by a 
closed source software.
The data is in the form of many TSV files (that I cannot share in 
full, just some redacted bits) with a header and a footer.
I don't want to hand modify these files or edit them in any way (I 
need to keep this as portable as possible, so no sed/awk/grep...)



OPTION 1: csvRead

That's the most intuitive solution, however, because of 
http://bugzilla.scilab.org/show_bug.cgi?id=16391 and the presence of 
more than 1 empty line in my header/footer, this crashes Scilab.



OPTION 2: hand parsing line by line using mgetl/meof

I tried:

filename="tsv.txt";
[fd, err] = mopen(filename, 'rt');
while ~meof(fd) do
    txtline=mgetl(fd,1);
end
mclose(fd)

Saddly, and contrary to what's written in "help mgetl", meof keeps on 
returning 0, well passed the end of the file and the while never ends!



OPTION 3: hand parsing chunk by chunk using mgetstr/meof

"help meof" does not confirm that meof should work with mgetl, but 
mgetstr is specifically listed.

I thus tried:

filename="tsv.txt";
[fd, err] = mopen(filename, 'rt');
while ~meof(fd) do
    txtchunk=mgetstr(80,fd);
end
mclose(fd)

But thanks to http://bugzilla.scilab.org/show_bug.cgi?id=16419 this is 
also crashing Scilab.



OPTION 4: Can anyone here help me with this?

I am really running out of ideas.
Did I miss some -hmm- obvious combination of available file parsing 
scilab functions to achieve my goal?
I have the feeling that it would have been faster for me to just learn 
a totally new language that does not suck at parsing files than trying 
to get it to work with scilab



Antoine

(depressed)



http://bugzilla.scilab.org/show_bug.cgi?id=16419


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 need to run Scilab as admin by  above 
mentioned method to write to certain folder.


hope this helps.

rgds,
CL


 On Wed, 04 Mar 2020 05:49:16 +0800 *Samuel Gougeon 
* wrote 


Le 03/03/2020 à 20:06, Perrichon a écrit :

PS

I have full read/write rights on my machine

This is the same issue as with Jan for bitget() last week.
I never install Scilab in the default directory C:\Program Files\
I think this is why i do not get this message.

If you had strictly no admin rights, you could even not copy the
file in its directory.
But maybe there is an intermediate level of administration...
Sometimes when we put such a copy in a "System" directory, we are
prompted for confirmation,
while theoretically being full rights admin.

One thing is sure: This is a Windows issue, not a Scilab one.

I will try installing Scilab in its default directory, and see how
Windows can be tuned to accept compiling Scilab libs.

Samuel

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users





___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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:

--> exec bitget.sci;
Warning : redefining function: bitget  . Use funcprot(0) 
to avoid this message


Regards

Jan


On 2020-02-28 16:25 PM, Samuel Gougeon wrote:

Hello Jan,

You will find => there 
 
a fixed version of bitget() for big u-int64 integers.

You can patch your Scilab 6.1.0 installation in the following way:

  * download and unzip the file. rename it bitget.sci
  * put bitget.sci in the SCI/elementary_functions/macros directory
  * Run the following Scilab code in the console:
cd SCI/elementary_functions/macros
predef clear
genlib elementary_functionslib
clear bitget

And then test and use bitget in the current session and all 
forthcoming ones.


Regards
Samuel

Le 27/02/2020 à 16:17, JLan a écrit :

I wonder if i have misunderstood the documentation for bitget, or if this is
a bug? It seems to me that numbers > 2^53 are still not handled correctly.
--> a=uint64(2^61)
  a  =   2305843009213693952
--> b=uint64(2^61)+1
  b  =   2305843009213693953
--> bitget(a,1:64)
  ans  =
  column 1 to 32
   0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0
  column 33 to 64
   0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  1  0  0

--> bitget(b,1:64)
  ans  =
  column 1 to 32
   0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  0  0  0
  column 33 to 64
   0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
0  0  0  0  1  0  0



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 2020-02-27 16:55 PM, Stéphane Mottelet wrote:

But the problem with bitget remains. The new bitstring is ok:

--> bitstring(a)
 ans  =

"0010"

--> bitstring(a+1)
 ans  =

"0011"

S.

Le 27/02/2020 à 16:37, Stéphane Mottelet a écrit :

You should generate big ints like this:

a=uint64(2)^61

S.

Le 27/02/2020 à 16:17, JLan a écrit :
I wonder if i have misunderstood the documentation for bitget, or if 
this is
a bug? It seems to me that numbers > 2^53 are still not handled 
correctly.

--> a=uint64(2^61)
  a  =   2305843009213693952
--> b=uint64(2^61)+1
  b  =   2305843009213693953
--> bitget(a,1:64)
  ans  =
  column 1 to 32
   0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 0  0  
0  0  0

0  0  0  0  0  0  0
  column 33 to 64
   0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 0  0  
0  0  0

0  0  0  0  1  0  0

--> bitget(b,1:64)
  ans  =
  column 1 to 32
   0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 0  0  
0  0  0

0  0  0  0  0  0  0
  column 33 to 64
   0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0 0  0  
0  0  0

0  0  0  0  1  0  0



--
Sent from: 
https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html

___
users mailing list
users@lists.scilab.org
https://antispam.utc.fr/proxy/2/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users 




___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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);
[pathname,filename,extname]=fileparts(fpne);
fp=list(fpne,pathname,filename,extname);
endfunction

fparts(fid)(1)// full path/filename.ext
fparts(fid)(2)// path
fparts(fid)(3)// filename
fparts(fid)(4)// extension

Jan

On 2019-12-27 17:00 PM, Federico Miyara wrote:


Jan,

Oh, thanks! That's much better than dispfiles, since it gives the name 
as a variable. I had seen that function but somehow I didn't realize 
that possibility.


Regards,

Federico Miyara


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 sure to remove DC offset in the tick, tock data to 
avoid clicks.


Maybe it will sound better in stereo ?

Brgds

Jan


On 2019-12-21 21:16 PM, P M wrote:

Dear experts,

I try to compose (design) a small sound file, made of several wav-files.

My question:   How to approach this task in the best way?


Here some input:

- sound 1: Tick-sound of a clock
- sound 2: Tock-sound of a clock

each wav-file has these properties:
- length: 0.1 sec
- bits: 32
- sample rate: 44100 Hz
- mono

Now:
I want to create a tick-tock sound of length  n-seconds  .. where I 
can choice the length of n

Each Tick-Tock-sound must be exactly 1-second apart from each other.

I load the sounds with: loadwave

Do I have to create a single "silent" wav file first, which is  
n-seconds long and than insert at the correct position the sound signal?


Thank you,
Philipp

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 5:37 AM, Federico Miyara wrote:



Stéphane,

Sorry for having explained myself so poorly. The problem with the 
macros already available is that in order to save a wavfile in a 
single operation, I need to have the whole signal loaded in a 
variable. I'm not sure whether it is possible to handle a variable 
with about 2 gigasamples (the maximum 16 bit mono file that Windows 
allows --a total file size of 4 GB--). This would demand 16 GB just 
for a single variable.


I'm pretty sure that problems would arise even with an audio variable 
much smaller than that.


This is the reason why I need to be able to append new audio data to 
an existing wave file, so that much less information is handled at a 
time. Of course this requires to edit the header to update the file 
size after the append, but this is quite easy.


The tough part is to save three byte numbers, since the existing mput 
command supports 1, 2, 4 and 8 byte formats, but not the 3 byte used 
for 24 bit audio. If there were a native macro or primitive capable of 
formatting numbers as 3 byte, it would be helpful.


Thanks,

Federico Miyara



On 17/12/2019 18:37, Federico Miyara wrote:


Stéphane,

wavewrite also supports 3 bytes, but as I commented, I cannot save, 
not evem generate huge files, so i must create them by successive 
appending, so i needto be able to save 3 byte numbers directly.


Thanks anyway.

Regards,

Federico Miyara

On 17/12/2019 17:15, Stéphane Mottelet wrote:

Hello

I think it is supported in savewave and loadwave. There was a pb 
with savewave but fixed by


https://codereview.scilab.org/#/c/19947/

in 6.0.2

S.

Le 17 déc. 2019 à 20:09, Federico Miyara  
a écrit :



Dear All,

While it is possible to create directly a wav file of reasonable 
size from Scilab, if the size is very large, say, 1 Gb,we willmost 
likely have memory problems. That's why I'm trying to program a 
script allowing to append new audio data to an existing wav file.


It is simple to save 8 bit, 16 bit and 32 bit samples to a file. 
However, 24 bit is also a popular format and Scilab doesn't seem to 
support 3 byte integer format, either for variables and read/write 
file operations.


Is there some way to save 3 byte integers other than creating a 
specialized routine from scratch?


Regards,

Federico Miyara
___
users mailing list
users@lists.scilab.org
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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)));


Jan

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 limitation somewhere, in Windows or Scilab 6.0.0 ?


Regards,

Rafael


Actually, just making  sure the first data line the longest seems to 
work too, for instance by adding spaces to it.


Jan
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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('grids_germany_monthly_radiation_direct_201706.asc')

I'm getting an error message. I suppose there is something wrong in that
file, but what and where exactly?

Not directly a Scilab problem (except for the fact that the 'fscanfMat'
error message could be more verbose), but maybe someone here has an 
idea how

to find the error...

Thanks
richard

This is what I get when using csvRead. It seems to be OK up to row  
558(after the header) - I renamed the file t.txt.


mmm=csvRead("t.txt"," ",[],[],[],[],,28);
Warning: Inconsistency found in the columns. At line 559, found 1307 
columns while the previous had 654.


csvRead: can not read file t.txt: Error in the column structure

Jan

It has to do with the line length , try to replace -999 with -9
Jan
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 message. I suppose there is something wrong in that
file, but what and where exactly?

Not directly a Scilab problem (except for the fact that the 'fscanfMat'
error message could be more verbose), but maybe someone here has an idea how
to find the error...

Thanks
richard

This is what I get when using csvRead. It seems to be OK up to row  
558(after the header) - I renamed the file t.txt.


mmm=csvRead("t.txt"," ",[],[],[],[],,28);
Warning: Inconsistency found in the columns. At line 559, found 1307 
columns while the previous had 654.


csvRead: can not read file t.txt: Error in the column structure

Jan
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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
http://lists.scilab.org/mailman/listinfo/users


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 following form:
DESC: AAA 2017
Datum;Zeit;kWh
01.01.2017;06:00;419,942
01.01.2017;07:00;513,273
01.01.2017;08:00;478,268
01.01.2017;09:00;711,572
01.01.2017;10:00;606,592
01.01.2017;11:00;594,92
01.01.2017;12:00;594,92
01.01.2017;13:00;524,933
...

I can read these in either as double or string
[log_data, comments] = csvRead(log_file, ";", ",", "double",[],
"/^[^0-9\-]/");

[log_data, comments] = csvRead(log_file, ";", ",", "string",[],
"/^[^0-9\-]/");

However what I'm missing is a way to convert the date & time column to a
date format in scilab. There doesn't seem to be function for this in scilab.
Is there a recommended way of doing so?

Thanks & regards
richard


PS:
I'm so glad the list is working again! Would have been nice tho to inform
the users in advance and with some sort of status.scilab.org site or
something...



--
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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
http://lists.scilab.org/mailman/listinfo/users


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 and I think this deserves a bug report.

Regards

--
Christophe Dang Ngoc Chan


Done
JÅ
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 it to Excel?
List is not a solution because I can copy it to the clipboard through the
variable browser.


Just convert the numerical value to a string:
date=["2007/1/1" "2008/2/2" "2009/3/3"]'
num=[1.1 2.2 3.3]'
Mdn=date
Mdn(:,2)=string(num)

Copy from variable browser or if you prefer, go via a csv file:

csvWrite(Mdn,"datafile.csv",";")

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 varies:

firstdata="2017"//something unique in the first dataline(or last header line)
maxheaderlength=10
Mh=mgetl(filename,maxheaderlength)
for  skiplines=1:size(Mh,1)
if  strindex(Mh(skiplines),firstdata)~=[]  then  
break

end
end
skiplines=skiplines-1

Md=csvRead(filename,"",[],"string",[],[],[],skiplines)

Jan-Åge
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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() 
and dec2hex() should work - etc.


Generally a lot of caution is needed when using these 64 bit integers.  
Example:


--> int64(2^62+256+1) //loss of prescision
 ans  =
  4611686018427387904

--> int64(2^62)+256+1 //correct
 ans  =
  4611686018427388161

--> int64(2)^62+256+1 // correct
 ans  =
  4611686018427388161


Jan Å



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 Gougeon wrote:

Hello,
Here is another (fast) implementation. You get directly all the binary 
blocs of a file in an output list.

Cheers
Samuel

function [res, bytes]=getBinaryBlocs(data, startstr, endstr) fid = 
mopen(data, 'rb') data = mgeti(1e6, 'uc', fid) mclose(fid) bytes = 
data s = data<32 | data>127 data(s) = ascii(".")


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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;
B=mgeti(btr+1,"uc",fid);
for i=1:btr+1
if B(i)>128 | B(i)<32 then B(i)=48; end
end
S=strsplit(ascii(B),btr);
strData=S(1);

[dataStart,dataEnd,dataMatch,data]=regexp(strData,'/#data#/')
...
Jan Å
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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


if  x,y,z  are column vectors of the same length you should try :


plot2d([x x],[y z],[y_color z_color])


the  argument [y_color z_color] is optional but it let you choose the
colors for both plots (try [2 5]  for [y_color z_color]).

Philippe.

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 the other contributions, I realised I misread the code.
However, I can't imagine a production process (milling, lathe machining or 
whatever) giving a uniform distribution for the dimensions .

But maybe "dimensional tolerances" does not concern machining.

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error), please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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


I had tried reinstall SciLab, but this does not helps.

Do you have any idea what can I do, to start using Scilab again?

Thanks in advance

Jakub Kopáč

NOTE: I am using Scilab 5.2.2-x64 on Win7PRO-64bit, without XCOS installed
and only reference math libraries.



--
View this message in context: 
http://mailinglists.scilab.org/Restoration-error-5-2-2-64bit-tp4034016.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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.

https://help.scilab.org/docs/5.5.2/en_US/return.html

HTH
Samuel 
Thanks a lot, works fine, although it is a bit sensitive to changes in 
the executed scripts.


Brgds
Jan Å
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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
!
!
!
!stdout
!


file() is clearly better than my suggestion.
nams is different in Scilab 5 and Scilab 6 and maybe vary with OS also, 
but since you know a bit about the script name you should be able to 
find it with grep:


nams(max(grep(nams,'getting')))

Jan Å


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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($), [filesep();]);
disp(b($-1));

The console window shows
--> ecec('gettingSscriptName.sce')

How to fix this?

Best regards



Hi

It looks like you are looking in a(1). Try to look in b($-1).
scriptname=b($-1);

This soluton works with standard execute in Windows 10 at least.  It 
will probably not cover "strange" ways to execute a script, but by 
analyzing the last history string you should be able to figure out what 
the user has been doing.


Brgds
Jan Å


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 different problem, when repeating your scf();plot(); 
  so I have 5-10 open graphical windows, Scilab crashes without warning.


Jan Å Langeland

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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

http://bugzilla.scilab.org/show_bug.cgi?id=14375

Brgds
Jan Å




a=input('How can this line cause Scilab 6.0.0 Beta to crash when 
pressing

enter?:');

Result in error message: Scilab 6.0.0(GUI) has stopped working - close
program.

Jan Å



--
View this message in context: 
http://mailinglists.scilab.org/Scilab-6-0-0-Beta-crashed-by-input-tp4033482.html
Sent from the Scilab users - Mailing Lists Archives mailing list 
archive at Nabble.com.

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 stacksize(a)  in 
Scilab 6, just let it do nothing.


Jan Å
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 = "disp(""Hello"")"
// Then click on the image => "Hello" should be displayed in the 
console for each click, but nothing is displayed.

// You may change the instructions => nothing is never done.

Samuel


What would a callback bring anyway, that you cannot do with xclick() ?

Jan Å
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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() in the callback ? :) Have a try.


I did try:

h.callback="disp(xclick())";  //disp can obviously be replaced with a suitable 
selection function.

I can get it to work in a two click mode: First click the button, then 
click an image next to the button.


The problem with making one big button with the picture on top, is that 
xclick() will not give the correct cursor position when on top of a 
button. Just static values [-2. -1. -1.].


"cbmenu - String: callback associated to a menu if |xclick| returns due 
to a click on a menu. In this case, |ibutton|, |xcoord|, |ycoord|, and 
|iwin| take arbitrary values".


Jan Å


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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:

figure()
h=uicontrol()
h.callback = "disp(""Hello"")"
h.position = [20,40,200,160]
im2=SCI + "/modules/demo_tools/images/logo_scilab.png";
h.string="$\scalebox{1}{\includegraphics{"+im2+"}}$"

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?):


Jan Å
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 imageWidth imageHeight], ..
"String", SCI + "/modules/demo_tools/images/logo_scilab.png");
Thank you, that works fine, but I find that I have more control over the 
image with:


im2=SCI + "/modules/demo_tools/images/logo_scilab.png";
xstring(0.4,0.4,"$\scalebox{.5}{\includegraphics{"+im2+"}}$");

Jan Å
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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

//xstring(0,-1,"$\scalebox{1}{\includegraphics{atoms.png}}$")
// Example with a remote image under http:// (http*s*: not accepted)
xstring(0,-1,"$\scalebox{1}{\includegraphics{http://www.cnrs.fr/fr/z-tools/newune/themes/CNRSTheme/images/logocnrs.png}}$;)
c.data(:,3)  =  0.1;  // <<< HERE
c.thickness  =  2;You may then tune the scalebox factor. Actually, like with an 
uicontrol(style="image"), the imported image is inlaid and is not 
resized accordingly with the embedding graphical figure. HTH Samuel 
Gougeon

Samuel

Thank you  for sharing these very good methods. It opens a lot of new 
possibilities.


The way I want to use images in figure I  find it better to modify your 
script with newaxis() before plotting. This makes the picture stay  
while zooming for instance:


clf
xstring(0,0,"$\scalebox{.3}{\includegraphics{http://photos.marinetraffic.com/ais/showphoto.aspx?photoid=445734}}$;); 
g=get("current_figure"); g.figure_size=[345,575]; b=newaxes(); b.filled 
= "off"; x  =  linspace(0,20,200);

plot(x,sin(x))

By the way it would have been interesting to see an example with 
uicontrol(style="image")  that you mention. I could never get that right.


Brgds
Jan Å


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 wrong.
I did not find a way to overlap a plot with transparent background 
over my image.
It seems that the image is always above the plot no matter what order 
the uicontrol/axes where created.
I also tried to put both of them inside the same frame, but I did not 
work either.


Any idea?




ShowImage(im,'J2');

b=newaxes(); b.filled = "off";  plot(a)

JÅ

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 
because of the buffering.

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

Well  when I watch the CPU load during execution of this script (in 
Windows 7 and 10), I can clearly see that they work longer and harder 
for Scilab 6. The load distribution is a bit different, Scilab 5.5 loads 
one CPU to 100%, while Scilab 6 distributes the load more on 2-4 CPUs.


Jan
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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; timer(); 
a=%f(ones(n,m)); disp(timer()); clear a; timer(); a(1:n,1:m)=%f; //best 
in Scilab 5.5.1 disp(timer()); clear a; //end script ftest.sce 
-->exec('ftest.sce',-1) !Scilab Version: 5.5.1.1412169962 ! 
1.482009500037543941 1.37280880029805233 
0.530403399546722393 0.296401899780135113 
-->exec('ftest.sce',-1) !Scilab Version: 6.0.0.1447231131 ! 0.6708043 
1.3260085 2.7300175 3.3228213


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 argument can be used to point at the correct output argument:


d  =
1.2.3.
4.5.6.
--> size(d)
 ans  =2.3.
--> size(d,1)
 ans  =2.
--> size(d,2)
 ans  =3.

JÅ

On 10.01.2016 16:52, animeshbaranawal wrote:

I have a function which has variable output arguments (using varargout). Now,
I want to access the nth output argument of the function. It is assured that
the function generates more than n output arguments.

Is there a method in scilab to do this?

Animesh



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 with the original Matlab commands at the front for reference.

Oddly, the straight Matlab code will run and make the plot after first
startingSc ilab, but will not if attempted again.

Is there a more elegant way of reading in a range of Te values?

Thanks for any pointers

Lester


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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]);
a=gca();  
b  =  newaxes();  
b.y_location  =  "right";  
b.filled  =  "off";  
b.axes_visible  =  ["off","on","on"];  
b.axes_bounds  =  a.axes_bounds;  
replot([t(1),ceil(t($));0  ,  6000]);

sca(a);
plot(t,x,'g',t(1:5)*20,y,'*r');
sca(b);
plot(t(1:5)*20,z,"*m")  ;






On 22.12.2015 11:37, Alasdair McAndrew wrote:

Hello,

I'm experimenting with fitting an ODE model (a non-linear system) to 
some data; what I want to do is to plot the curves representing the 
ODE numerical solutions against the initial (discrete) data points.  
And I want to be able to specify the thickness and color of the 
curves, as well as providing a legend to it.


I can do the curves by carefully using gca, gce etc, and copying and 
pasting examples from the documentation, but I don't yet know how to 
plot the data points.


For example, I have a time vector containing about 150 points, and an 
array containing all the corresponding ODE values; thus:


plot2d(t,x',style=[color("red"),color("green"),color("blue")]);

However, I don't know how to include in this plot the 14 or 15 data 
points.


I find gca, gce somewhat tricky to use - is there an easier way: a 
front end to plotting multiple curves and specifying the 
characteristics of each curve?


Many thanks,
Alasdair

--
http://www.facebook.com/alasdair.mcandrew 
 
https://plus.google.com/+AlasdairMcAndrew/posts 
 
https://www.linkedin.com/pub/alasdair-mcandrew/a/178/108 
 
https://twitter.com/amca01  
http://numbersandshapes.net 



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 running scilab-5.5.0 on Ubuntu 14.04.

When I run the attached script and then run "graphalot" for a while,



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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 will take
a time when row number is large .

Best regards.




--
View this message in context: 
http://mailinglists.scilab.org/getting-the-first-column-number-of-each-row-tp4033132.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users





___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


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:$);
strb="Another very long legend. Vive la France";
str1b=  part(strb,1:27);
str2b=  part(strb,28:$);
clf();
f=gcf();
replot([1  6  ;-1.5  2]);
plot(x,y1,"..r",x,y1,"..w",x,y2,"g",x,y2,"w",x,y1,"..r",x,y2,"g");
legend(str1,str2,str1b,str2b);


JÅ


On 14.11.2015 12:36, fujimoto2005 wrote:

Hello Rafael Guera

This is a great solution!!
Thanks a lot.

Best regards



--
View this message in context: 
http://mailinglists.scilab.org/long-legend-tp4033087p4033090.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users