How can I use an IF function on a Global variable?

I have a global variable that is a 6x1 array. At the the start of my code I call it up:
global myglob
I then want to add some functions depending on the values within the array ie:
if
myglob = [1 1 1 1 1 1]
then
...
elseif
myglob = [1 1 1 1 1 0]
...
end
My problem is that this code is setting the global variable, not calling it, and the if function is not working. any thoughts/ideas?
Many thanks in advance

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2017년 11월 13일

0 개 추천

In your "if" statement, you mean to compare the value, you need to use "==" or isequal(), not "=".

카테고리

제품

태그

질문:

2017년 11월 13일

답변:

2017년 11월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by