How do i calculate the standard deviation from multiple csv files where i would like the standard deviation for each second?

5 Ansichten (letzte 30 Tage)
This is what one of my many csv files look like, i would like to get the standard deviation for the temperatures at the different depths (0,2 and 4 mm) for each second. Thanks in advance!
  2 Kommentare
Matlab Pro
Matlab Pro am 30 Jan. 2025
Hi @axel.
Few unclear issues:
  • So you need a Matlab-Excel automation to fullfille this?
  • Which exect Ecel function you want to use for the columns? (i.e. "STDEV.S" = "Estimates standard deviation based on a sample (ignores logical values and text in the sample")).
  • So- the outcome for every CSV processed is a vector of the length of # of columns, each value = std of theat column. Correct?
axel
axel am 30 Jan. 2025
I have now complied the many csv files down to three files, each for the temperature over time at each specific depth (0,2 and 4mm). I have attached a photo of one of these said files. the 5.7,5.7.2, etc is refering to the sample number.
I am wondering if it is possible to calculate the standard deviation in MATLAB and not in excel. If this is rather complicated i can use excel however, I am more inclined to trust MATLAB than excel.
Thanks again in advance!

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Star Strider
Star Strider am 30 Jan. 2025
Bearbeitet: Star Strider am 30 Jan. 2025
Perhaps this —
Time = datetime('now')+seconds(0:2).';
Time.Format = 'H:mm:ss';
Temperature = [20.754 19.219 19.338 20.89; 20.75 19.186 19.323 20.882; 20.784 19.186 19.312 20.857];
T1 = array2table(Temperature);
T1 = addvars(T1, Time, Before=1);
T1.Properties.VariableNames={'Time (Seconds)','(2mm_1)','(0mm)','(4mm)','(2mm_2)'}
T1 = 3x5 table
Time (Seconds) (2mm_1) (0mm) (4mm) (2mm_2) ______________ _______ ______ ______ _______ 11:07:49 20.754 19.219 19.338 20.89 11:07:50 20.75 19.186 19.323 20.882 11:07:51 20.784 19.186 19.312 20.857
T1.StdDev = std(T1{:,2:end},[],2)
T1 = 3x6 table
Time (Seconds) (2mm_1) (0mm) (4mm) (2mm_2) StdDev ______________ _______ ______ ______ _______ _______ 11:07:49 20.754 19.219 19.338 20.89 0.89419 11:07:50 20.75 19.186 19.323 20.882 0.90487 11:07:51 20.784 19.186 19.312 20.857 0.90925
.
EDIT — (30 Jan 2024 at 11:18)
With respect to the different files, see Import or Export a Sequence of Files.
.

Kategorien

Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by