Index in position 2 exceeds array bounds error AppDesigner

I'm currently getting this error, but it doesn't make much sense to me because my index is within the size of the cell array. I'm running a code within a function in an app I designed with app designer. The goal is to load two arrays, and replace the first column of the first array with the second column of the second array. Within the funtion, I have two separte arrays already defined. They are:
CurrentColorArray =
15×7 cell array
{[ 1]} {[106]} {[112]} {[216]} {[51.3920]} {[ 26.1110]} {[-54.3120]}
{[ 2]} {[123]} {[180]} {[174]} {[69.4040]} {[-19.8240]} {[ -2.8730]}
{[ 3]} {[113]} {[186]} {[182]} {[70.8730]} {[-23.7110]} {[ -5.1590]}
{[ 4]} {[128]} {[180]} {[173]} {[69.6450]} {[-18.5800]} {[ -1.9370]}
{[ 5]} {[109]} {[117]} {[218]} {[52.9870]} {[ 24.3580]} {[-52.8800]}
{[ 6]} {[113]} {[121]} {[208]} {[53.7480]} {[ 19.8450]} {[-45.9940]}
{[ 7]} {[ 71]} {[156]} {[143]} {[59.0650]} {[-28.9480]} {[ -0.9900]}
{[ 8]} {[113]} {[123]} {[214]} {[54.5850]} {[ 20.4400]} {[-48.0600]}
{[ 9]} {[100]} {[109]} {[220]} {[50.4670]} {[ 27.9390]} {[-58.0830]}
{[10]} {[121]} {[131]} {[218]} {[57.4230]} {[ 18.7800]} {[-45.7770]}
{[11]} {[ 74]} {[167]} {[152]} {[62.8090]} {[-31.2730]} {[ -0.5720]}
{[12]} {[109]} {[162]} {[141]} {[62.5190]} {[-22.2700]} {[ 5.3600]}
{[13]} {[180]} {[150]} {[205]} {[66.4620]} {[ 21.5710]} {[-24.0690]}
{[14]} {[184]} {[143]} {[201]} {[65.0050]} {[ 25.9440]} {[-24.0370]}
{[15]} {[194]} {[154]} {[204]} {[68.7090]} {[ 23.7110]} {[-19.9670]}
CurrentSampleIDs =
15×2 cell array
{[ 1]} {'1-2-1-a'}
{[ 2]} {'1-2-2-a' }
{[ 3]} {'1-2-3-a' }
{[ 4]} {'2-2-1-a' }
{[ 5]} {'2-2-2-a' }
{[ 6]} {'2-2-3-a' }
{[ 7]} {'3-2-1-a' }
{[ 8]} {'3-2-2-a' }
{[ 9]} {'3-2-3-a' }
{[10]} {'4-2-1-a'}
{[11]} {'4-2-2-a' }
{[12]} {'4-2-3-a'}
{[13]} {'5-2-1-a' }
{[14]} {'5-2-2-a'}
{[15]} {'5-2-3-a' }
After these are defined, I try to run the following line of code:
CurrentColorArray(:,1) = CurrentSampleIDs(:,2)
And recieve the error "Index in position 2 exceeds array bounds". The strange part is, when I pause the code on that line in debugger, then copy and paste the exact same thing in the command window, it runs just fine and gives me:
CurrentColorArray =
15×7 cell array
{'1-2-1-a'} {[106]} {[112]} {[216]} {[51.3920]} {[ 26.1110]} {[-54.3120]}
{'1-2-2-a' } {[123]} {[180]} {[174]} {[69.4040]} {[-19.8240]} {[ -2.8730]}
{'1-2-3-a' } {[113]} {[186]} {[182]} {[70.8730]} {[-23.7110]} {[ -5.1590]}
{'2-2-1-a' } {[128]} {[180]} {[173]} {[69.6450]} {[-18.5800]} {[ -1.9370]}
{'2-2-2-a' } {[109]} {[117]} {[218]} {[52.9870]} {[ 24.3580]} {[-52.8800]}
{'2-2-3-a' } {[113]} {[121]} {[208]} {[53.7480]} {[ 19.8450]} {[-45.9940]}
{'3-2-1-a' } {[ 71]} {[156]} {[143]} {[59.0650]} {[-28.9480]} {[ -0.9900]}
{'3-2-2-a' } {[113]} {[123]} {[214]} {[54.5850]} {[ 20.4400]} {[-48.0600]}
{'3-2-3-a' } {[100]} {[109]} {[220]} {[50.4670]} {[ 27.9390]} {[-58.0830]}
{'4-2-1-a'} {[121]} {[131]} {[218]} {[57.4230]} {[ 18.7800]} {[-45.7770]}
{'4-2-2-a' } {[ 74]} {[167]} {[152]} {[62.8090]} {[-31.2730]} {[ -0.5720]}
{'4-2-3-a'} {[109]} {[162]} {[141]} {[62.5190]} {[-22.2700]} {[ 5.3600]}
{'5-2-1-a' } {[180]} {[150]} {[205]} {[66.4620]} {[ 21.5710]} {[-24.0690]}
{'5-2-2-a'} {[184]} {[143]} {[201]} {[65.0050]} {[ 25.9440]} {[-24.0370]}
{'5-2-3-a' } {[194]} {[154]} {[204]} {[68.7090]} {[ 23.7110]} {[-19.9670]}
Since it has no issue running in the command window, I can't for the life of me figure out why it has a bug in the app itself. Has anyone seen something like this before?

답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

릴리스

R2020a

질문:

2020년 9월 15일

댓글:

2020년 9월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by