Value not adding to variable in array
이전 댓글 표시
When I run the code below and test it in my app. One of the variables in count should be 1, however, when, I display it it this is not the case. If i display the count array, for example, for f = 4. The fourth cell shows as one but if i display Count4 straight after is displays as zero. Any help would be much appreciated. Before the arrays i just had the code run for each individual set of variables (e.g. Fill1, Count 1, RAHWin, YAHWin) and the code would work as needed but turning them into arrays broke it. There seems to be a problem setting the values for count into the coutnt variable. I can attatch more code if nessecary but any help would be much appreciated.
app.Fill = {app.Fill1,app.Fill2,app.Fill3,app.Fill4,app.Fill5,app.Fill6,app.Fill7};
app.Count = {app.Count1,app.Count2,app.Count3,app.Count4,app.Count5,app.Count6,app.Count7};
app.RHWin = {app.RAHWin,app.RBHWin,app.RCHWin,app.RDHWin,app.REHWin,app.RFHWin,app.RGHWin};
app.YHWin = {app.YAHWin,app.YBHWin,app.YCHWin,app.YDHWin,app.YEHWin,app.YFHWin,app.YGHWin};
for f = 1:numel(app.Fill)
if app.Fill{f} == 1
disp(app.Count4)
app.Count{f} = app.Count{f} + 1;
app.Fill{f} = 0;
disp(app.Count{f})
if app.Past == app.Red
app.RHWin{f} = app.RHWin{f} + 1;
app.YHWin{f} = 0;
elseif app.Past == app.Yellow
app.YHWin{f} = app.YHWin{f} + 1;
app.RHWin{f} = 0;
end
end
end
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!