# Debugging issue in a function

**URL:** <https://community.wolfram.com/t/debugging-issue-in-a-function/574>\
**Category:** Questions\
**Tags:** computer-science, engineering, interface-construction\
**Created:** [September 18, 2013, 7:09pm UTC](https://community.wolfram.com/t/debugging-issue-in-a-function/574 "2013-09-18T19:09:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mahabubce](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@mahabubce](https://community.wolfram.com/u/mahabubce)\
**Post date:** [September 18, 2013, 7:09pm UTC](https://community.wolfram.com/t/debugging-issue-in-a-function/574/1 "2013-09-18T19:09:59Z")

</div>

Hi There!  
I am new to Mathematica. One of my former colleagues coded a function in a .nb file, the function with six variables looks like the following:

```auto
GRegressions[fileDirectory_, fileName_, \ incrementStop_, substrateToughness_, interfaceToughness_, dataCheck_, \ correctionFactor_] := 

```

Now, I am trying to call the function from another .nb file in the following way:

```auto
GRegressions["/scratch/Example_Fracture/", "85deg_usubv101a.dat", 266, 10.0, 0.40, "yes", 1]; 

```

The main issue is I am not seeing any error message or anything else to work with. When I press Shift+Enter, it just doesn’t show me anything.  
I would appreciate any of your advice about how can I proceed further?

Thank you so much!  
-Rajib

---

<div class="post-metadata">

**Author:** ![ychung](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ychung/32/1838_2.png) [@ychung](https://community.wolfram.com/u/ychung)\
**Post date:** [September 18, 2013, 7:27pm UTC](https://community.wolfram.com/t/debugging-issue-in-a-function/574/2 "2013-09-18T19:27:22Z")

</div>

Hi,

Remove the semicolon (😉 at the end and try again. The semicolon suppresses the output.

Youngjoo Chung

---

<div class="post-metadata">

**Author:** ![mahabubce](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@mahabubce](https://community.wolfram.com/u/mahabubce)\
**Post date:** [September 18, 2013, 8:03pm UTC](https://community.wolfram.com/t/debugging-issue-in-a-function/574/3 "2013-09-18T20:03:46Z")

</div>

Hello Youngjoo!

I removed the semicolon “;”. It is showing me the same function Out[10] = GRegressions[“/scratch/Example\_Fracture/”, “85deg\_usubv101a.dat”, 266, 10.0, 0.40, “yes”, 1]. It is not showing the output of the function. I would like to see the output of the function. Could you please help me with this?

Many thanks!  
-Rajib

---

<div class="post-metadata">

**Author:** ![brucem](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/brucem/32/26319_2.png) [@brucem](https://community.wolfram.com/u/brucem)\
**Post date:** [September 18, 2013, 9:07pm UTC](https://community.wolfram.com/t/debugging-issue-in-a-function/574/4 "2013-09-18T21:07:15Z")

</div>

In the second notebook, evaluate

```auto
?GRegressions

```

to make sure the second notebook can see the definition from the first notebook.

My understanding is that you opened the notebook with the definition,  
ran it, then opened the second notebook and tried to run it. All this in the same  
Mathematica Kernel session. (You did not quit anything between creating the  
function definition and using it, right?)

---

<div class="post-metadata">

**Author:** ![mahabubce](https://avatars.discourse-cdn.com/v4/letter/m/ecccb3/32.png) [@mahabubce](https://community.wolfram.com/u/mahabubce)\
**Post date:** [September 18, 2013, 9:38pm UTC](https://community.wolfram.com/t/debugging-issue-in-a-function/574/5 "2013-09-18T21:38:49Z")

</div>

Hi Bruce!

Yes, I think you are correct. I am sorry, I am the beginner of Mathmatica, I have some novice type of questions: a) How can I make sure if the second notebook has connection with the first one (the one with definition)? I kept both files in the same directory; b) Should I close the definition one while I am running the second notebook? I closed the first one but still not seeing the output.

I highly appreciate your help.  
-Rajib

---

<div class="post-metadata">

**Author:** ![brucem](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/brucem/32/26319_2.png) [@brucem](https://community.wolfram.com/u/brucem)\
**Post date:** [September 18, 2013, 9:54pm UTC](https://community.wolfram.com/t/debugging-issue-in-a-function/574/6 "2013-09-18T21:54:16Z")

</div>

Safer to leave the first notebook open and use File menu - Open to locate and open the second notebook.  
The two notebooks will share a Mathematica Kernel (the calculating engine) so all the definitions will be  
shared as long as Mathematica front end and Kernel are running.

---

<div class="post-metadata">

**Author:** ![ychung](https://yyz1.discourse-cdn.com/wolfram/user_avatar/community.wolfram.com/ychung/32/1838_2.png) [@ychung](https://community.wolfram.com/u/ychung)\
**Post date:** [September 18, 2013, 11:29pm UTC](https://community.wolfram.com/t/debugging-issue-in-a-function/574/7 "2013-09-18T23:29:22Z")

</div>

Hi,

There are two possible reasons:  
(1) there is mismatch in function argument patterns;  
(2) the function was not loaded.

If all the arguments in the function definition have only Blank (\_), then (1) is OK.  
As for (2), you need to load the function by executing the function definition in the notebook that contains it. You can do it by clicking the mouse inside the cell with the function definition and by typing Shift+Enter. If you are using a recent version of Mathematica, the function name GRegressions in GRegressions[“/scratch/Example\_Fracture/”, “85deg\_usubv101a.dat”, 266, 10.0, 0.40, “yes”, 1] is in blue color if the function has not been loaded. It will turn to black once the function is loaded. The notebook can then be closed.

If the function will be repeatedly used, it is better to make a package. Then you can load the function using the command Get (\<\<). See Mathematica documentation for details.

Youngjoo Chung
