Re: [Scilab-users] how to faster EVSTR?

2019-10-21 Thread Chin Luh Tan
For the sub-question, it is not true that userdata can only have string data. 
It could be any datatype of Scilab (at least the common one, :))



the reason you could not set the numeric data likely due to you're trying to 
mix string and number: 

[spectrum_unit_x, string(spectrum(:,1)'),string(spectrum(:,2)')]

 

I believe your "spectrum_unit_x" is in string so you need to convert the second 
and 3rd to string to match the datatype.



1 option is that, you could save them in list:



set(gcbo,"userdata", list(spectrum_unit_x, spectrum(:,1)',spectrum(:,2)')



then you should be able to extract the data by using the index.



mydata = get(gcbo,'userdata')

mydata(2) and mydata(2) for the spectrum 1 and 2 respectively.



hope this helps.



CL





 On Mon, 21 Oct 2019 22:37:17 +0800 CRETE Denis 
 wrote 



Hello, 
For the first question: did you try 
test_number= msscanf(-1,test_str,'%f'); 
or 
test_number= strtod(test_str); 
? 
HTH 
Denis 
* 
Hi all, 
 
I have a 1 Milion entries array of STRING type (test_str array), I should 
convert to number (test_numer array). 
 
I do as follow: 
test_number=evstr(test_str) 
 
It looks like working but it takes a not acceptable time... 
 
Do you have a more clever idea? 
 
--- 
Sub-question: I have such a long string array because I get it from an 
uicontrol 'userdata' and it looks to me only string data can be set as 
'userdata'. 
Is that true or, in fact, I could simply set the user data as a number array 
(without converting it in string witn the 'string' command)? 
Now I do as follows: 
"set(gcbo,"userdata",[spectrum_unit_x, 
string(spectrum(:,1)'),string(spectrum(:,2)')])" 
 
-- 
Many thanks 
cheers 
Anna 
 
 
 
-- 
Sent from: 
http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
 
___ 
users mailing list 
mailto:users@lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users 
___ 
users mailing list 
mailto: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} Curves color when plotting

2019-10-21 Thread Chin Luh Tan
Hi,



from my understanding, easiest way to get the color you wanted is by specifying 
it during the plot function. 

--> plot(x,sin(x),'b')

--> plot(x,cos(x),'b')

will gives u 2 blue lines.





By default, scilab figure will following the sequence as stated in "help plot"





"A default color table is used to color plotted curves if you do not specify a 
color. When drawing multiple lines, the plot command automatically cycles 
through this table. Here are the used colors:"



R   G   B

0.  0.  1.

0.  0.5  0.

1.  0.  0.

0.  0.75  0.75

0.75  0.  0.75

0.75  0.75   0.

0.25  0.25   0.25



no matter what colormap you are changing to before the plot, the plot w/o color 
input will search for the "blue" in the newly define colormap as well. 



If the previous methods does not work for you, you could plot the graph, find 
the handle for the line, and change it according to the color index in the 
colormap for the figure.




plot(x,sin(x),x,cos(x))


f = gcf();

f.children.children.children.foreground

f.children.children.children.foreground(1) = 2;




this will change the second line to blue, as the default colormap f.colormap 
define blue in the second row. (f.color_map)




hope this helps.



rgds,
CL



 On Mon, 21 Oct 2019 18:41:09 +0800 Dang Ngoc Chan, Christophe 
 wrote 



Hello Pierre, 
 
> De : Perrichon 
> Envoyé : lundi 21 octobre 2019 12:05 
> 
> Generally, when plotting, curves's color are taken in the range color 
> [1 3 5 7 9 11 13 15 [...] Is there a general way to modify this vector 
> as to get another one with blue as first curve. 
 
You might consider redefining the colour map: 
 
https://help.scilab.org/docs/6.0.2/en_US/colormap.html 
 
Hope this helps, 
 
regards 
 
-- 
Christophe Dang Ngoc Chan 
Mechanical calculation engineer 
 
General 
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 
mailto: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] how to faster EVSTR?

2019-10-21 Thread CRETE Denis
Hello,
For the first question: did you try 
test_number= msscanf(-1,test_str,'%f');
or 
test_number= strtod(test_str);
?
HTH
Denis
*
Hi all,

I have a 1 Milion entries array of STRING type (test_str array), I should
convert to number (test_numer array).

I do as follow:
test_number=evstr(test_str) 

It looks like working but it takes a not acceptable time...

Do you have a more clever idea?

---
Sub-question: I have such a long string array because I get it from an
uicontrol 'userdata' and it looks to me only string data can be set as
'userdata'.
Is that true or, in fact, I could simply set the user data as a number array
(without converting it in string witn the 'string' command)?
Now I do as follows:
"set(gcbo,"userdata",[spectrum_unit_x,
string(spectrum(:,1)'),string(spectrum(:,2)')])"

--
Many thanks
cheers
Anna



--
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] {EXT} how to faster EVSTR?

2019-10-21 Thread Dang Ngoc Chan, Christophe
Hello,

> De : anna78
> Envoyé : lundi 21 octobre 2019 16:02
>
> test_number=evstr(test_str)
>
> It looks like working but it takes a not acceptable time...
>
> Do you have a more clever idea?

You might try strtod()

Generally, the evaluation or execution of strings should be avoided
because one could put some malevolent code inside a string.

Hope this helps,

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

General
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


[Scilab-users] how to faster EVSTR?

2019-10-21 Thread anna78
Hi all,

I have a 1 Milion entries array of STRING type (test_str array), I should
convert to number (test_numer array).

I do as follow:
test_number=evstr(test_str) 

It looks like working but it takes a not acceptable time...

Do you have a more clever idea?

---
Sub-question: I have such a long string array because I get it from an
uicontrol 'userdata' and it looks to me only string data can be set as
'userdata'.
Is that true or, in fact, I could simply set the user data as a number array
(without converting it in string witn the 'string' command)?
Now I do as follows:
"set(gcbo,"userdata",[spectrum_unit_x,
string(spectrum(:,1)'),string(spectrum(:,2)')])"

--
Many thanks
cheers
Anna



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


Re: [Scilab-users] {EXT} Curves color when plotting

2019-10-21 Thread Dang Ngoc Chan, Christophe
Hello Pierre,

> De : Perrichon
> Envoyé : lundi 21 octobre 2019 12:05
>
> Generally, when plotting, curves's color are taken in the range color
> [1 3 5 7 9 11 13 15 [...] Is there a general way to modify this vector
> as to get another one with blue as first curve.

You might consider redefining the colour map:

https://help.scilab.org/docs/6.0.2/en_US/colormap.html

Hope this helps,

regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer

General
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


[Scilab-users] Curves color when plotting

2019-10-21 Thread Perrichon
Dear all,

 

Generally, when plotting, curves's color are taken in the range color [1 3 5
7 9 11 13 15], where 1 is the black color.

So, the first curve is black

 

Is there a general way to modify this vector as to get another one with blue
as first curve.

I don't search something like children(i).foreground=xxx, but a generic
instruction to do when launching a sce or sci files

 

This possible in xcos, with a cscope where colors can be re-organized

Exemple in a cscope : [2 3 5 4 6 16 13 15]

 

Best Regards

 

Pierre P.

 

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