I want to compare a url to a specific path to see if they match. I have tried so many variations and just can't get it to work, the two items I need to use are
{%CurrentDocument.RelativeURL.Replace("~","")%}
and
{&/{0}/{1}/{2}|(tolower)&}
In the current test scenario, both of these return the same string, however, when I put them together
{%CurrentDocument.RelativeURL.Replace("~","")|(equals){&/{0}/{1}/{2}|(tolower)&}|(truevalue)yes#%}
I get a false result displaying, I'm pretty positive it's because I can't nest a path expression inside an expression but not sure if there is another way? Any help would be appreciated.
Thanks
According to the documentation you should be able to substitute path macro with {%Path.path%}. Then there is no need to nest different types of macros but use the Path the same way as CurrentDocument.
Related
First of all, matlab version is 2011b, so I cannot use Simulink.MaskParameters class.
I have one simulink mask and some parameters inside. I need to determine in my function for each parameter if it is "evaluable" or "tunable".
Those two things are two checkboxes in the mask parameters dialog which you can select for any parameter.
For "tunable", there's the MaskTunableValues property. For "enable", there's the "MaskEnables" property.
Do you know if there's a way to programmatically access the same property but for "evaluate" ?
Thanks
#Phil Goddard's answer shows you how to find the parameter. To complete the answer, the actual parameter is MaskVariables. Evaluate flag is embedded into the MaskVariables string. It is not straightforward to modify this. For example for two parameters MaskVariables string contains something like this:
"a=#1;b=&2;"
In this string the # sign indicates evaluation. Based on that, parameter a is evaluated and parameter b is not. If you want to change the evaluate flag, you need to set this string for MaskVariables parameter exactly how it was except for # or & signs.
For more information see R2011b documentation for mask parameters at https://www.mathworks.com/help/releases/R2011b/toolbox/simulink/slref/f23-18517.html. Towards the bottom of the page there is more detail about MaskVariables parameter.
You're using too old a release for most people to be able to give you an exact solution, however, I'm sure (from memory) that this parameter is available.
If you click on the mask to select the block, then go to the MATLAB command line and type
get_param(gcb,'ObjectParameters')
you'll get a list of all the block properties. (You may already know that since you're aware of MaskTunableValues and MaskEnables.) Near the bottom of that list are all of the properties related to the mask.
Now manually look at each/all of those properties, e.g.
get_param(gcb,'MaskTunableValues')
and you'll find that one of them is a structure that contains the information that you're looking for. (You may need to dig down into the structure to find the specific info.)
Answer for versions > 2011b (tested on 2014b):
Ok found it, actually the matlab documentation is REALLY unclear regarding the Simulink.MaskParameter class and here is how it works:
First, get the Mask class from your block:
mask = Simulink.Mask.get(gcb)
The Mask class is a structure containing all mask parameters:
parameters = mask.Parameters(:)
parameters is a (array of) Simulink.MaskParameter object which will contains all the necessary properties, including Evaluate.
Im constructing a URL from query items using URLComponents and I want to add some query items as OR conditions rather than AND. Im not sure what the proper terminology for this is. Anyway I would like the following, roughly
website.com/things?param1=thing¶m2=thing|param3=thing|param4=thing
but appending query items i can only get
website.com/things?param1=thing¶m2=thing¶m3=thing¶m4=thing
My goal is to check 3 different parameters for the term I pass in, and return any results that match from any of the 3. If I was constructing the url from a string, I could just use a pipe instead of ampersand (I think - please correct me if wrong), but Im using URLComponents and am not sure how to do this.
Perhaps Im going about this incorrectly. I dont have a ton of experience with this. If this is the wrong approach, please point me in the right direction. Im not sure how to word this question appropriately and that makes it hard to search for an answer
Im not sure what the proper terminology for this is
There is no terminology for it; it doesn't exist. What you're trying to do is nonstandard. There is no such thing as a query item OR condition. Standard separators are semicolon and ampersand, with ampersand used almost universally. You can't use a pipe to separate query items.
Thus, for example, if you paste website.com/things?param1=thing¶m2=thing|param3=thing|param4=thing into the parser at http://www.freeformatter.com/url-parser-query-string-splitter.html, it doesn't know what to make of the pipes; it thinks that param2 must be thing|param3=thing|param4=thing.
Thus, URLComponents is not going to insert the pipe for you. Its goal and purpose is to make a valid URL, and you are attempting to make an invalid one.
I'm using the VLOOKUP function to move data from one table into another. I need to apply this formula to an entire column, and I need to know how to define certain parameters as variable and some as constant.
Here's my problem:
=VLOOKUP($D8,Sheet2.A1:B20,2)
becomes, when I drag the corner of the cell across multiple rows,
=VLOOKUP($D8,Sheet2.A1:B20,2)
=VLOOKUP($D9,Sheet2.A2:B21,2)
=VLOOKUP($D10,Sheet2.A3:B22,2)
=VLOOKUP($D11,Sheet2.A4:B23,2)
And what I need is
=VLOOKUP($D8,Sheet2.A1:B20,2)
=VLOOKUP($D9,Sheet2.A1:B20,2)
=VLOOKUP($D10,Sheet2.A1:B20,2)
=VLOOKUP($D11,Sheet2.A1:B20,2)
With the first parameter changing and the rest remaining constant. I'm sure there is an easy way to do this, but searching and browsing help topics is returning nothing. I admittedly have zero background in spreadsheets. Thanks for your help
Add more $ signs, like this:
=VLOOKUP($D8,Sheet2.$A$1:$B$20,2)
https://help.libreoffice.org/Calc/Addresses_and_References,_Absolute_and_Relative
I'm using eclipse parser to work with expressions and statements in java code.
I have a function:
public boolean visit(PostfixExpression node)
which deals with Postfix expressoins, such ass i++;
Problem is i want to distinguish between a for statement postfix, and other postfixes.
I thought maybe i could get to the node's parent and somehow check if it's a for. Something like node.getParent()... but node.getParent() doesn't return an expression.
Any ideas how to recognize if the PostfixExpression belongs to a for loop?
Thanks
edit:
By "for statement postfix" i mean the postfix in the for loop's first line. Such as:
for(i=0;i<10;i++)
So i want to distinguish this i++ from other i++'s.
Can't you just call ASTNode.getParent() to see what kind of statement the expression is contained in?
I solved this by creating a for_updaters List (using node.updaters()) and updating it every time i visit a for loop (could also be nested loops). Also, whenever i come across a PostfixExpression (including for updaters), i add it to another List, and then delete from this List all similar occurrences that appear in for_updaters List. This way i'm only left with non-for-updaters Postfixes. This also works for me because every time i visit a for loop i clear both Lists, so no worries about duplicate variable names.
Note: node.updaters() returns the exact full expression: [i++]. But i only need i. It's easy to extract it by converting the updater to String and then use substring().
Is there any way to get the indices of the same string (that appears more than once) in a single array? I know I can find a specific string's location using:
[nameOfArray indexOfObject:#"apple"]
Of course, I could create a for loop essentially using the same code above and ignoring the previous "apples" found. I can't help to feel that there is a simpler (built-in) way to do this in objective-c. Am I right?
Thank you all in advance.
You could use indexesOfObjectsPassingTest with the "test" block being a block that tests for equality.