Clear Filters
Clear Filters

Why is not working to use listbox in my case?

4 views (last 30 days)
Muazma Ali
Muazma Ali on 21 Jan 2024
Commented: Voss on 28 Jan 2024
The problem :
This is a much much simpler version of my app three that I have called for tester_app_3.
When I write disp(app.error) before if app.error==1 in tester_app_3, it does not give me the right value though it is set to be right in the functions. The value of error is just set in the combinations’s functions CaCl2_MgCl2_ZnBr2 and NaCl2_KCl_ZnBr. The other functions just compute some other values
In other words the program is not going further to the combinations I chose. Thats why it gives me the value of app.error to be ==0
I have called the simpler version of my app3 as tester_app_3, reduced the app to be much smaller than it was by removing many functions from CaCl2_ MgCl2_ ZnBr2 and NaCl_KCl_ZnBr2 and letting the smaller functions remain a part of the functions. The only big functions that I have included are the two combinations functions CaCl2_ MgCl2_ ZnBr2 and NaCl_KCl_ZnBr2 and beregn_ionic_strength_best_salts_NaCl_KCl_ZnBr2 and beregn_ionic_strength_best_salts_CaCl2_MgCl2_ZnBr .
ONLY THE CaCl2_ MgCl2_ ZnBr2 and NaCl_KCl_ZnBr2 are relevant for the problem ( I had to adjust the code within these functions so that I didnt need to attach too many functions :).
Kindly help me with my problem.
  5 Comments
Muazma Ali
Muazma Ali on 28 Jan 2024
@Voss I think you have misunderstood a little bit; I placed disp (app.error) statement after the if statement for CaCl2 MgCl2 and ZnBr2 and not after NaCl KCl ZnBr2 , thats why the value of disp(app.error ) must be 1 , when I dont chose the first combination of salts..and it is not that what the app is giving me..
Voss
Voss on 28 Jan 2024
You think that you have written the program so that "the value of disp(app.error ) must be 1 , when I dont chose the first combination of salts", but that's not what the program is doing.
As I explained before, when index is [1 4 6], then the following line gives app.idx = [1 2 3]
app.idx = find(index);
In fact a selection of any three salts gives app.idx = [1 2 3]. Look:
find([1 4 6])
ans = 1×3
1 2 3
find([2 7 8])
ans = 1×3
1 2 3
find([99 100001 1823746])
ans = 1×3
1 2 3
Sounds like you mean to simply do:
app.idx = index;
instead of using find there.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!