- #1

- 310

- 0

Would code such as this work in MATLAB?

if (condition 1)

if (sub condition 1)

Code

elseif (sub condition 2)

Code

elseif (condition 2)

if (sub condition 3)

Code

elseif (sub condition 4)

Code

end

- MATLAB
- Thread starter SherlockOhms
- Start date

- #1

- 310

- 0

Would code such as this work in MATLAB?

if (condition 1)

if (sub condition 1)

Code

elseif (sub condition 2)

Code

elseif (condition 2)

if (sub condition 3)

Code

elseif (sub condition 4)

Code

end

- #2

kreil

Gold Member

- 668

- 67

Code:

```
a = 6;
if abs(a) <= 5
if a < 0
a = -a;
elseif a > 3
a = a -2;
end
elseif abs(a) > 5
if a > 10
a = a - 5;
elseif a < 7
a = a -2;
end
end
a
a =
4
```

- #3

- 310

- 0

Thanks!

- Last Post

- Replies
- 1

- Views
- 3K

- Replies
- 1

- Views
- 4K

- Replies
- 3

- Views
- 1K

- Replies
- 6

- Views
- 7K

- Replies
- 2

- Views
- 3K

- Last Post

- Replies
- 1

- Views
- 2K

- Replies
- 1

- Views
- 5K

- Last Post

- Replies
- 5

- Views
- 1K

- Last Post

- Replies
- 44

- Views
- 3K

- Last Post

- Replies
- 2

- Views
- 2K