App designer: Dot indexing is not supported for variables
28 views (last 30 days)
Show older comments
I am creating the UI using app designer and at line 124 I am getting error about dot indexing problem. I have also posted the question before did not get the desired answer. Here attaching the mlapp file. Please provide help got stuck since long.
....ERROR MESSAGE.....
Dot indexing is not supported for variables of this type.
Error in DataProcess_July2020/LoadB0datacalculatefieldmapButtonPushed (line 124)
app.idx = listdlg('ListString', {app.sFOLDERS(:).name}, 'SelectionMode', 'single', ...
Error using matlab.ui.control.internal.controller.ComponentController/executeUserCallback (line 382)
Error while evaluating Button PrivateButtonPushedFcn.
0 Comments
Answers (2)
Kiran Felix Robert
on 17 Aug 2020
Hi Medical Imaging,
I understand that you are trying to access the ‘name’ field of the app.sFOLDERS structure
The reason behind the error is that, when the control flows to line 124, the ‘app.sFOLDER’ does not contain the ‘name’ field. Moreover, it is not even a structure it is just an empty array of type double.
You can verify this by displaying the contents of app.sFOLDER just before line 124 (Try adding breakpoints).
or try,
class(app.sFolders);
Assigning the app.sFOLDERS structure to the file/folders list before using the ‘name’ field might solve the issue .
(From your appDesigner code I also understand that the app.sFOLDERS is assigned the output of the ‘dir’ command in the ‘LoadFileandprocessFIDButtonPushed’ callback function, verify if this callback assigns the correct structure to the ‘app.sFOLDERS’ from your end.)
Hope this Helps.
Kiran Felix Robert
Alon Zaharony
on 28 Apr 2022
I had the same issue. Eventually, i've figured out that the problem is related to a parameters file i am using that was missing in the compiled version.
The file (called "param.ini") was in my projects folder and i used the PWD function to call it.
For some reason, on the compiled version, the PWD gave me the following path:
"C:\Users\<user_name>\AppData\Local\Temp\<user_name>\mcrCache9.6\<project_name>\"
Since the file wasn't there, it hasn't been loaded and as a result the parameters were missing.
Optional solutions:
1) when compiling, make sure to add all the required functions and files to the "Files required for your application to run".
2) Don't use PWD for compiled apps. Instead, use specific path.
Hopefully it will help someone in the future.
0 Comments
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!