# substitute

0

Hi,

I have the following line in my code with the intention to replace some elements in matrix ini1 with 1. However, the matrix stays the same. I wonder if there is anything wrong with my use of substute.

```ini1[.,q]=substute(ini1[.,q], inn[.,q]-0.01.<0, 1);
```

Thank you!

Tags: asked April 4, 2013

0

Your code should make some changes to ini1 if some of the elements in the qth column are less than 0.01. Here is a little self-contained example:

```inn = { 1, 0.001, 0, 2, 3 };
ini1 = 999*ones(rows(inn), 1);
q = 1;

print "before substute, ini1 = " ini1;
ini1[.,q]=substute(ini1[.,q], inn[.,q]-0.01.<0, 1);
print "after substute, ini1 = " ini1;
```

The output from this code is:

```before substute, ini1 =
999.00000
999.00000
999.00000
999.00000
999.00000
after substute, ini1 =
999.00000
1.0000000
1.0000000
999.00000
999.00000
```
aptech
615
0

I might try calculating the separate input on another line of code and then take a look at it to see if it has any 1's in it, like this:

```mask = (inn[.,q] - 0.01) .< 0;
```

If there are no 1's in the print out of mask then that is the problem.

aptech
615

• ### Aptech Systems, Inc. Worldwide Headquarters

Aptech Systems, Inc.
2350 East Germann Road, Suite #21
Chandler, AZ 85286

Phone: 360.886.7100
FAX: 360.886.8922

Ready to Get Started?

• ### Training & Events

Want more guidance while learning about the full functionality of GAUSS and its capabilities? Get in touch for in-person training or browse additional references below.

• ### Tutorials

Step-by-step, informative lessons for those who want to dive into GAUSS and achieve their goals, fast.

• ### Have a Specific Question?

Get a real answer from a real person

• Need Support?
• ### Support Plans

Premier Support and Platinum Premier Support are annually renewable membership programs that provide you with important benefits including technical support, product maintenance, and substantial cost-saving features for your GAUSS System or the GAUSS Engine.

• ### User Forums

Join our community to see why our users are considered some of the most active and helpful in the industry!

• ### Where to Buy

Available across the globe, you can have access to GAUSS no matter where you are.