Unrecognized function or variable 'length'. error in app designer
1 回表示 (過去 30 日間)
古いコメントを表示
Alright, so I'm running an app I made that I've successfully run a few times already, and I'm suddenly receiving this error. This is the line of code it is occuring on:
for n = 1:length(app.T1Names)
% replace the numbered regions in each color array
% with the corresponding sample ID's
CurrentColorArray = T1_data{2,n};
CurrentSampleIDs = T1_data{3,n};
CurrentColorArray(:,1) = CurrentSampleIDs(:,2);
T1_data{2,n} = CurrentColorArray;
end
The odd part is, if I pause with debugger on the [for n = 1:length(app.T1Names)] line, then run "length(app.T1Names)" in the command window, it spits out the answer without any issue. Why would it have an issue recognizing the variable "length" from within app designer if the same line of code is fully functional during debugging?
Edit: When searching for this issue, I did come upon answers where the individual set a previous variable to "length". I did check for this by searching the code for "length =", and I also checked for that variable during debugging, and nowhere has anything been set to that, so that is not the issue here.
Edit 2: When I select "step" from that line in debugger mode, matlab pulls up the script titled "AppManagementService.m", and points to line 349 which says catch exception. I am unsure what this means or why this would happen.
Edit 3: This error propegates to other functions as well. I tried replacing the values for length(app.____) with numbers everywhere it happens just to finish analyzing the set of data I'm on, and the next function that uses length(app.____) has the same error. I've used this syntax in earlier functions within my app without issue, so I'm not sure why it would randomly stop recognizing the function.
1 件のコメント
Adam Danz
2020 年 10 月 4 日
Could your provide the full error message?
FYI, it's recommended to use numel(app.T1Names) rather than length().
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Data Type Identification についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!