Hello, Here is a one liner solution:
HEX=[ "FFFFFF" "D9FFFF" "CC80FF" "C2FF00" "FFB5B5" "909090" "3050F8" "FF0D0D" "90E050" "B3E3F5" ] --> matrix(hex2dec(strsplit(strcat(HEX),2:2:length(strcat(HEX))-1)),3,-1)' ans = 255. 255. 255. 217. 255. 255. 204. 128. 255. 194. 255. 0. 255. 181. 181. 144. 144. 144. 48. 80. 248. 255. 13. 13. 144. 224. 80. 179. 227. 245. S. On 02/10/2023 09:52, Lester Anderson wrote: Hello, I am trying to loop through a vector of strings but having issues with the strsplit function. The vector consists of HEX values for colours. I created a simple function to get RGB values. function rgb=hex2rgb(x) // x=string input hexrgb=strsplit(x,[2 4])'; rgb=hex2dec(hexrgb); endfunction --> HEX HEX = "FFFFFF" "D9FFFF" "CC80FF" "C2FF00" "FFB5B5" "909090" "3050F8" "FF0D0D" "90E050" "B3E3F5" etc The function works fine with single values as that is what strsplit expects, but not sure how to make it run through the string vector; indexing causes issues. Any pointers would be helpful. Thanks Lester This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged. If you are not one of the named recipients or have received this email in error, (i) you should not read, disclose, or copy it, (ii) please notify sender of your receipt by reply email and delete this email and all attachments, (iii) Dassault Systèmes does not accept or assume any liability or responsibility for any use of or reliance on this email. Please be informed that your personal data are processed according to our data privacy policy as described on our website. Should you have any questions related to personal data protection, please contact 3DS Data Protection Officer https://www.3ds.com/privacy-policy/contact/ _______________________________________________ users mailing list - users@lists.scilab.org<mailto:users@lists.scilab.org> Click here to unsubscribe: <mailto:users-unsubscr...@lists.scilab.org><mailto:users-unsubscr...@lists.scilab.org> https://lists.scilab.org/mailman/listinfo/users This email and any attachments are intended solely for the use of the individual or entity to whom it is addressed and may be confidential and/or privileged. If you are not one of the named recipients or have received this email in error, (i) you should not read, disclose, or copy it, (ii) please notify sender of your receipt by reply email and delete this email and all attachments, (iii) Dassault Systèmes does not accept or assume any liability or responsibility for any use of or reliance on this email. Please be informed that your personal data are processed according to our data privacy policy as described on our website. Should you have any questions related to personal data protection, please contact 3DS Data Protection Officer https://www.3ds.com/privacy-policy/contact/
_______________________________________________ users mailing list - users@lists.scilab.org Click here to unsubscribe: <mailto:users-unsubscr...@lists.scilab.org> https://lists.scilab.org/mailman/listinfo/users