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 で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!