Re: [Scilab-users] Loop over string vector

2023-10-04 Thread Stéphane Mottelet
Hello, Here is a one liner solution: HEX=[ "FF" "D9" "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.

Re: [Scilab-users] Loop over string vector

2023-10-04 Thread Lester Anderson
Hello Thanks for the suggestions. The 'part' option worked but the function fails at hexrgb=strsplit(x(i),[2 4])'; strsplit: Wrong size for input argument #1: A single string expected. This was the issue I was having initially, logically it should work, but looks like it just sees x as a

Re: [Scilab-users] Loop over string vector

2023-10-04 Thread Lester Anderson
Quick update. Following Serge, I managed to get from the HEX code to RGB via the following, avoiding the issue of the submatrix incorrectly defined. rgb=[part(Hex_colour,1:2),part(Hex_colour,3:4),part(Hex_colour,5:6)]; for i = 1:size(rgb,1) red(i)=hex2dec(rgb(i,1)); green(i)=hex2dec(rgb(i,2));

Re: [Scilab-users] Loop over string vector

2023-10-03 Thread Pinede Romain
Anderson Envoyé : lundi 2 octobre 2023 09:53 À : International users mailing list for Scilab. Objet : [Scilab-users] Loop over string vector 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

[Scilab-users] Loop over string vector

2023-10-03 Thread Lester Anderson
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])';