Data Table Parsing Function - Intelligent VLOOKUP() - Сообщения
VLOOKUPdataparse.sm (17 КиБ) скачан 73 раз(а).
If an element of a defined matrix contains a user defined function with an undefined parameter it may inthrow an error similar to here (same SMath file as above):
I would expect the function with undefined parameter to return itself instead of giving an error code.

I think the issue comes out because there isn't a way to stop the preprocessing in user-defined functions when you pass an unknown (and an unknown is not a valid input).
A workaround that might be useful even to avoid the use of other functions is to use a string as input in the second row, and a check in your lookup like this:
Is the a reason why function like findstr() does not return itself when not all variables are defined? Similar to this:
http://en.smath.info/forum/yaf_postsm36158_cases-in-definition-of-a-function.aspx#post36158
Also I am not sure if this is similar, but after I modified my excel_IO() function to return FALSE if undefined variables were present it would preprocess correctly with undefined variables when passed as an argument to a user defined function (you and I had an email discussion about this).
P.S.: the reason why a more general solution is desired is because a one might want to implement a more complex boolean check, than <>=!
WroteIs the a reason why function like findstr() does not return itself when not all variables are defined? Similar to this:
http://en.smath.info/forum/yaf_postsm36158_cases-in-definition-of-a-function.aspx#post36158
It is by design. However even returning itself, you will have always var=findstr(...) -> false -> ... (it doesn't prevents the strcont() function to be evaluated)
WroteAlso I am not sure if this is similar, but after I modified my excel_IO() function to return FALSE if undefined variables were present it would preprocess correctly with undefined variables when passed as an argument to a user defined function (you and I had an email discussion about this).
Yes, but with functions created on the canvas this isn't possible

WroteP.S.: the reason why a more general solution is desired is because a one might want to implement a more complex boolean check, than <>=!
You can try with this:
strcont() is defined locally to avoid the preprocessing on the canvas
try() function is added because when you use el(...) inside the lookup function, all the elements of the condition matrix are evaluated -> you have to allow any type of input as first argument or let it fails silently (because strrep requires strings); note that if the selected element of the condition matrix is the one that contains strcon() with a wrong type as first argument, the error string will trigger an error on bool#:eval(bool#*operand#), because operand# will be a string.
The attached proposal is for fixed "credit".
It might be ranged via bolean.
Jean
Alex VLOOKUPdataparse.sm (33 КиБ) скачан 64 раз(а).
WroteAlex,
The attached proposal is for fixed "credit".
It might be ranged via bolean.
Jean
Alex VLOOKUPdataparse.sm (33 КиБ) скачан 64 раз(а).
Thanks, Jean. I havent used "truth tables" yet; they seem to work quite well.
In vb.net I can assemble 13x10000 SMath matrix in 3.3 seconds (excel_OUT), while stacking of 488 rows (13 elements each) into matrix within SMath takes 21 seconds
Thanks!
Wrotewhile stacking of 488 rows (13 elements each) into matrix within SMath takes 21 seconds
Hello Alex, can you attach an example where stack it is so slow?
It depends what you assemble, and how.
Three examples attached.
Jean
Alex Assemble Matrix.sm (32 КиБ) скачан 49 раз(а).
WroteWrotewhile stacking of 488 rows (13 elements each) into matrix within SMath takes 21 seconds
Hello Alex, can you attach an example where stack it is so slow?
Here it is - I use EXCEL to input 10000 x 13 matrix into SMATH - 1.2 seconds. Vlookup() loop to stack 400 rows - 15 seconds. Vlookup() loop which does not stack anything is 3 seconds.
VLOOKUPslow.sm (27 КиБ) скачан 56 раз(а).
DATA.xlsx (1 МиБ) скачан 70 раз(а).
VLOOKUPfast.sm (31 КиБ) скачан 125 раз(а).
WroteTry this; basically removes all stack() calls to build the matrix after you check all the conditions. On my notebook is 50% faster than your.
VLOOKUPfast.sm (31 КиБ) скачан 125 раз(а).
Much better, thanks.
Could you explain how does the following exactly work:
resultrng#:el(data#,matches,range(1,cols(data#)))
WroteMuch better, thanks.
Could you explain how does the following exactly work:
resultrng#:el(data#,matches,range(1,cols(data#)))
You're welcome

It is this feature; in the 2nd argument of el(3) there are all the rows I want from first argument's matrix, as 3rd argument all the columns. The result is a matrix of the elements that fits both the requirements, in the given order.
from vlookupfast.sm modification, may it be simplified for such a situation below. in case condition only use boolean 'equal to' as the same in any spreadsheet function.
Utilities Matrix Locate Array1 Array2.sm (70 КиБ) скачан 63 раз(а).
-
Новые сообщения
-
Нет новых сообщений