The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
65 views

Returning value if a point is in a region?

I'm writing a function so that if the user clicks on a certain region, a value is returned. The function takes in a condition list like the one below and a point. ...
3
votes
2answers
314 views

How to force Return[] to return from an arbitrary point (like in C++)?

I need to test some complicated conditions to calculate a Return value. But MMa doesn't let you Return[] from anywhere the way C++ does. The structure of my Module is similar to this: ...
4
votes
1answer
133 views

Throw and Catch return wrong result inside Compile

Consider this code: fun = Compile[{{i, _Integer}}, Catch[Do[ If[j >= i, Throw[j]] , {j, 1, 10}]] ] I put an integer as argument then if this ...
1
vote
1answer
68 views

Throw and Catch or Return inside Compile

Consider this code: ...
1
vote
1answer
233 views

How to check empty tables using SQL Select or Execute?

If[SQLExecute[con, "Select * from TABLE"] == "{}", Print["TRUE"], Print["FALSE"]] I need to know the way, if the TABLE is empty or not
1
vote
2answers
94 views

Returning ancillary computation results from a function

Suppose I want to implement a function to solve a very basic Elliptic problem using Finite Element of some degree (It's just an example). Normally the user of my function is only interested to the ...
7
votes
1answer
326 views

Returning a value from a Module

In the following simple example MyMod := Module[{i}, Do[ Return[1], {i, 3} ]; Print["test"] ] I expected the module to exit on ...
6
votes
1answer
154 views

Return struct from function (with DownValues)

In Mathematica there is a way to create struct-like data type: struct[myField]=value I want to return myStruct from a function: ...
3
votes
2answers
1k views

Function returning Null along with other unexpected expressions

When I use some function, at the end along with the output I get some NULLs returned that I don't understand the reason for and are highly undesirable. For example, when I define the reversal of list ...
11
votes
4answers
727 views

How can I return a Sequence?

Recently I had the need to redefine a certain symbol in my init.m so it would be automatically omitted from any lists it appears in. I decided to redefine it to an empty sequence, e.g. ...
5
votes
4answers
798 views

Compile and “True should be a machine-size real number…” Error

I am trying to compile a little summation function. As far as I understand, because the built-in Sum function can also return ...
30
votes
7answers
4k views

How to avoid returning a Null if there is no “else” condition in an If contruct

I need to use If but with only one option that is if "a" then do "b", else do nothing. So I wrote If[a,b] but the problem is ...