[Scilab-users] how to faster EVSTR?

Chin Luh Tan chinluh.tan at bytecode-asia.com
Tue Oct 22 05:04:21 CEST 2019


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 <mailto:denis.crete at thalesgroup.com> 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 at lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users 
_______________________________________________ 
users mailing list 
mailto:users at lists.scilab.org 
http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20191022/9a62f431/attachment.htm>


More information about the users mailing list