Undefined function or variable "corUL

if CW==0 %These options will only be displayed once!
h=figure();
plot(pos(:,2),pos(:,3),'k')
axis ij;axis equal
hold on
plot(spikeloc(:,2), spikeloc(:,3), 'o', 'markersize', 2, 'MarkerFaceColor', 'r','markeredgecolor','r')
disp('Pick the upper-left corner by selectioning the area with the mouse')
corUL=getrect(h); %Corner Upper-left. Vector with following values [xmin ymin width height]
disp('Pick the lower-left corner by selectioning the area with the mouse')
corLL=getrect(h); %Corner lower-left. Vector with following values [xmin ymin width height]
disp('Pick the upper-right corner by selectioning the area with the mouse')
corUR=getrect(h); %Corner Upper-right. Vector with following values [xmin ymin width height]
disp('Pick the lower-right corner by selectioning the area with the mouse')
corLR=getrect(h); %Corner lower-right. Vector with following values [xmin ymin width height]
end
for i=1:length(pos(:,2))
if CW==move_dirc(i) || CW==2 %Only positions with the right direction movement will be saved
if (pos(i,3) < corners(1,2) || pos(i,3) < corners(3,2))&& ...
(pos(i,2) > corUL(1)+corUL(3))&&(pos(i,2) < corUR(1)) %Condition before '&&' selects the segment. Condition after '&&' removes corners
seg_1(upd_1,:)=[pos(i,2) pos(i,3) pos(i,5) pos(i,6) pos(i,1)]; %For each of the segments we will save position, pixel and time (x,y,px,py,t)
upd_1=upd_1+1;
elseif (pos(i,2) < corners(1,1) || pos(i,2) < corners(2,1))&&...
(pos(i,3) > corUL(2)+corUL(4))&&(pos(i,3) < corLL(2))
seg_2(upd_2,:)=[pos(i,2) pos(i,3) pos(i,5) pos(i,6) pos(i,1)];
upd_2=upd_2+1;
elseif (pos(i,3) > corners(2,2) || pos(i,3) > corners(4,2))&&...
(pos(i,2) > corLL(1)+corLL(3))&&(pos(i,2) < corLR(1))
seg_3(upd_3,:)=[pos(i,2) pos(i,3) pos(i,5) pos(i,6) pos(i,1)];
upd_3=upd_3+1;
elseif (pos(i,2) > corners(3,1) || pos(i,2) > corners(4,1))&&...
(pos(i,3) > corUR(2)+corUR(4))&&(pos(i,3) < corLR(2))
seg_4(upd_4,:)=[pos(i,2) pos(i,3) pos(i,5) pos(i,6) pos(i,1)];
upd_4=upd_4+1;
end
end
end

1 件のコメント

Adam
Adam 2016 年 9 月 2 日
What exactly are you expecting someone to do with that? There's no question. If you are getting an error message then post the full red text of the error message and let us know what line it refers to if it isn't obvious.

サインインしてコメントする。

回答 (1 件)

John D'Errico
John D'Errico 2016 年 9 月 2 日

0 投票

The crystal ball is so foggy. As hard as we try to read your mind, we cannot do so.
MATLAB has at least tried to tell you what is wrong. There is apparently a variable named corUL that you are trying to use here. It does not exist. Wanting something to exist that does not exists? It just tends to fail. For example, I just tried wanting to have a winning lottery ticket in my hands. Nope, did not work.
So, look at your code:
disp('Pick the upper-left corner by selectioning the area with the mouse')
corUL=getrect(h); %Corner Upper-left. Vector with following values [xmin ymin width height]
You should define that variable. Apparently you did not use getrect properly.
You might try reading the help for getrect. As well, in the future, try reading the error messages, and think about what they say.

カテゴリ

ヘルプ センター および File ExchangeEntering Commands についてさらに検索

質問済み:

2016 年 9 月 2 日

回答済み:

2016 年 9 月 2 日

Community Treasure Hunt

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

Start Hunting!

Translated by