Effacer les filtres
Effacer les filtres

error message undefined variable best_salt_2

2 vues (au cours des 30 derniers jours)
Muazma Ali
Muazma Ali le 17 Jan 2022
Commenté : Muazma Ali le 17 Jan 2022
I cant see that best_salt_2 hasnt got a value in this function I have attached; I get an error saying ''undefined variable best_salt_2''
Can somebody help me? :)
  3 commentaires
Naveen Somasundaram
Naveen Somasundaram le 17 Jan 2022
Hey there, The error you get is probably because you have not set the value i.e initialized variable best_salt_2 before trying to check something on it, for example performning isempty(best_salt_2) on an undefined variable will throw that error.
Can you screenshot the error line and your workspace at that point. I can explain it better then.
PS: try to intend the code so it is readable. It saves a lot of time in debugging.
Muazma Ali
Muazma Ali le 17 Jan 2022
@KSSV Hi This is the input that goes in from another function,
S={'NH4Cl'; 'MgCl2'; 'CaCl2'; 'KCl'; 'ZnSO4'; 'NaCl'; 'ZnBr2'; 'CH3CO2K';'HCOOK';'HCOONa'; 'CaBr2'};
str={'Choose salts available, minimum of two and maximum of three'};
result=listdlg('Promptstring',str, 'ListSize', [100,100], 'ListString', S, 'SelectionMode', 'multiple');

Connectez-vous pour commenter.

Réponses (1)

Muazma Ali
Muazma Ali le 17 Jan 2022
@Naveen Somasundaram I have tried to inted the code now. I get the message at the same line as the
if ~isemtpy(best_salt_1)&&~isemty(best_salt_2)
  1 commentaire
Muazma Ali
Muazma Ali le 17 Jan 2022
Think I have found the problem with my code guys ! :)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by