1

When I run the below code, values of vf are printed in each iteration step. But after the code completely finished, when I type plot(vf) I get the error:

Unrecognized function or variable 'vf'.

Here is my code:

global Y
global vf
vf=[];
c=0;
for i=0:100:500
    c=c+1;
%%this is a function by which I read the data for Y
    readdata(i);    
    vf(cnt) = mean(mean(Y .* Y))
end

Could somebody please help me with solving this problem?

1 Answer 1

2

The question is a little awkward with all the global declarations.

I suppose the solution is declaring global vf before using plot(vf):

global vf
plot(vf)

See global documentation.

In case is't not working, it's hard telling why.

Sign up to request clarification or add additional context in comments.

2 Comments

Sorry, I'm not plotting vf. I want to keep its value
Wow! Thank you very much. I think it is working now!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.