I don't know why matlab says my variable is undefined

blocks1 was a cell created by my script file used to split an image into blocks. However when I tried to use this in my function I got an error message saying the variable is undefined

Answers (1)

You did not pass blocks1 to your function, and you did not arrange to share the variable some other way. You should be passing it to the function.

3 Comments

Exactly, you should pass blocks1 and blocks2. Also, I don,t see the point of passing n and m if you are defining these variables inside.
Simply change n,m in the arguments for blocks1 and blocks2: function [ SAVD ] = calculateSAVD(blocks1 ,blocks1 2,blockSizeX,blockSizeY)
Sorry I've just been doing programming for a few weeks, can I just ask what you mean by passing blocks1 to my function.
Also I had to use the variables m and n because I need to index a particular array from blocks1
I'm actually trying to create a block matching algorithm function and this was the starting code, any help to create this would be greatly appreciated

Sign in to comment.

Categories

Asked:

on 27 Nov 2017

Edited:

on 28 Nov 2017

Community Treasure Hunt

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

Start Hunting!