Azzera filtri
Azzera filtri

Solving for mean from a file imported to matlab

1 visualizzazione (ultimi 30 giorni)
Kevin
Kevin il 22 Nov 2013
Commentato: Walter Roberson il 22 Nov 2013
In a file that is formatted like
18.6-37.4-48.9-66.8-82.0-94.4 valid
19.2-32.7-47.0-68.2 valid
18.9-37.7-49.0-68.1-82.6-93.8 valid
24.5-33.3-51.7-64.4-83.3 valid
23.6-39.9-50.1-68.8-80.9-91.5-107.0 corrupted
I am having trouble extracting the numbers from each line of code (amount of lines is in the hundreds) and finding the mean of all numbers. I have attempted to open the file and then use a while loop with a regexp function to draw out all the numbers and then convert the class back to double using str2num (still in the while loop) however when I attempt to use function sum or mean at any given point it says it cannot convert class cell with those functions.
  1 Commento
Walter Roberson
Walter Roberson il 22 Nov 2013
Do the dashes represent negative signs? What if a number in the middle is positive instead: will there be a + sign or will there be a space?
The number of values on each line differs, right?
Please show your existing code. I know you are able to get some input values because that was shown to you in http://www.mathworks.co.uk/matlabcentral/answers/106962-searching-for-numbers-above-a-certain-threshold

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Argument Definitions in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by