How can I get the set number from a set?

2 visualizaciones (últimos 30 días)
Alex Wheeler
Alex Wheeler el 4 de Mzo. de 2021
Comentada: Stephen23 el 4 de Mzo. de 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 comentario
Stephen23
Stephen23 el 4 de Mzo. de 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:

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Descriptive Statistics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by