<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta content="text/html;charset=UTF-8" http-equiv="Content-Type"></head><body ><div style="font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt;"><div>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, :))<br></div><div><br></div><div>the reason you could not set the numeric data likely due to you're trying to mix string and number: <br></div><div>[spectrum_unit_x, string(spectrum(:,1)'),string(spectrum(:,2)')]<br></div><div> <br></div><div>I believe your "spectrum_unit_x" is in string so you need to convert the second and 3rd to string to match the datatype.<br></div><div><br></div><div>1 option is that, you could save them in list:<br></div><div><br></div><div>set(gcbo,"userdata", list(spectrum_unit_x, spectrum(:,1)',spectrum(:,2)')<br></div><div><br></div><div>then you should be able to extract the data by using the index.<br></div><div><br></div><div>mydata = get(gcbo,'userdata')<br></div><div>mydata(2) and mydata(2) for the spectrum 1 and 2 respectively.<br></div><div><br></div><div>hope this helps.<br></div><div><br></div><div>CL<br></div><div><br></div><div class="zmail_extra" style=""><div><br></div><div id="Zm-_Id_-Sgn1">---- On Mon, 21 Oct 2019 22:37:17 +0800 <b>CRETE Denis <<a href="mailto:denis.crete@thalesgroup.com" target="_blank">denis.crete@thalesgroup.com</a>></b> wrote ----<br></div><div><br></div><blockquote style="border-left: 1px solid rgb(204, 204, 204); padding-left: 6px; margin: 0px 0px 0px 5px;"><div>Hello, <br>For the first question: did you try <br>test_number= msscanf(-1,test_str,'%f'); <br>or <br>test_number= strtod(test_str); <br>? <br>HTH <br>Denis <br>********************************************* <br>Hi all, <br> <br>I have a 1 Milion entries array of STRING type (test_str array), I should <br>convert to number (test_numer array). <br> <br>I do as follow: <br>test_number=evstr(test_str) <br> <br>It looks like working but it takes a not acceptable time... <br> <br>Do you have a more clever idea? <br> <br>--- <br>Sub-question: I have such a long string array because I get it from an <br>uicontrol 'userdata' and it looks to me only string data can be set as <br>'userdata'. <br>Is that true or, in fact, I could simply set the user data as a number array <br>(without converting it in string witn the 'string' command)? <br>Now I do as follows: <br>"set(gcbo,"userdata",[spectrum_unit_x, <br>string(spectrum(:,1)'),string(spectrum(:,2)')])" <br> <br>-- <br>Many thanks <br>cheers <br>Anna <br> <br> <br> <br>-- <br>Sent from: <a href="http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html" target="_blank">http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html</a> <br>_______________________________________________ <br>users mailing list <br><a href="mailto:users@lists.scilab.org" target="_blank">users@lists.scilab.org</a> <br><a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a> <br>_______________________________________________ <br>users mailing list <br><a href="mailto:users@lists.scilab.org" target="_blank">users@lists.scilab.org</a> <br><a href="http://lists.scilab.org/mailman/listinfo/users" target="_blank">http://lists.scilab.org/mailman/listinfo/users</a> <br></div></blockquote></div><div><br></div></div><br></body></html>