getting arrays into matrix
Show older comments
hi all, newbie here. working on an RT60 calculator in the app creator, and i'm trying to arrange several arrays into one matrix, but i keep getting an error message for it, and i can't seem to figure out why it doesn't work. here's a screenshot of it. please help

7 Comments
Walter Roberson
on 12 May 2022
We are not given any information about the value of LeftWallMaterial
Vilmos Popelyak
on 12 May 2022
Walter Roberson
on 12 May 2022
Edited: KSSV
on 12 May 2022
I suggest that you configure Items Data Array for the list box.
Jan
on 12 May 2022
I have no idea, what a "RT60 calculator is. I assume, this detail is not relevant.
Please post code as text, not as screenshot. This makes it much easier to type an answer.
The error message explains, that the contents of "LeftWallMaterial" is not a valid index. Use the debugger to check this. Type this in the command window:
dbstop if error
Run the code until it stios at the error. Then check the value of the index.
Vilmos Popelyak
on 12 May 2022
Vilmos Popelyak
on 12 May 2022
@Vilmos Popelyak: Of course it does. This is the purpose of the dbstop command. When Matlab stops at the error, you can examine the locvally used variables and find out, why the index is not a positive integer.
If this code is encapsulated in y TRY/CATCH block, this command stops Matlab more powerful:
dbstop if caught error
Answers (1)
Binaya
on 2 Nov 2023
0 votes
Hi Vilmos,
Based on your description, it seems that you want to address an error that occurs when executing the code, specifically the error message "Index in position 1 is invalid. Array indices must be positive integers or logical values."
Upon reviewing the provided code, it appears that the error arises from passing the value of the "LeftwallmaterialDropDown" as an index to an array using the function “str2double()”.
To resolve this error, please ensure that the value selected in the "Leftwallmaterial" drop-down menu in the app designer is not a character, negative number, zero, or a fractional number. These types of values are not valid as array indices.
I hope this helps.
Regards
Binaya
Categories
Find more on National Instruments Frame Grabbers 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!