How can I get the set number from a set?

2 vues (au cours des 30 derniers jours)
Alex Wheeler
Alex Wheeler le 4 Mar 2021
Commenté : Stephen23 le 4 Mar 2021
I have written the following code, I want to determine which of the following protein_mass's is the lowest, how can I go about that?
disp('IMPORTANT: Before you input any numbers please remember to type the inputs in chronological order of the samples to have the best chance possible of having correct data')
volume = input('Enter the volumes of the sample (in μL) with [] surrounding them: ');
concentration = input('Enter the total protein concentration (in μg/mL) with [] surrounding them: ');
mass_fraction = input('Enter the mass fraction of Gal-7hFc (mass Gal-7hFc/total mass protein) with [] surrounding them: ');
protein_mass1 = (volume(1)/1000) * concentration(1); %mass in μg
protein_mass2 = (volume(2)/1000) * concentration(2); %mass in μg
protein_mass3 = (volume(3)/1000) * concentration(3); %mass in μg
protein_mass4 = (volume(4)/1000) * concentration(4); %mass in μg
Gal_mass1 = protein_mass1 * mass_fraction(1);
Gal_mass2 = protein_mass2 * mass_fraction(2);
Gal_mass3 = protein_mass3 * mass_fraction(3);
Gal_mass4 = protein_mass4 * mass_fraction(4);
protein_masses = [protein_mass1 protein_mass2 protein_mass3 protein_mass4];
min(protein_masses);
  1 commentaire
Stephen23
Stephen23 le 4 Mar 2021
"I want to determine which of the following protein_mass's is the lowest, how can I go about that?"
Answer: use the second output from min.
Tip: avoid numbering variable names like that. Effective use of MATLAB means keeping data together in vectors/matrices/arrays and applying operations to the entire array at once. This is often simpler and more efficient:

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Descriptive Statistics dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by