Hi there,
I'm looking for assistance sorting data ( increasing and decreasing order ). I've attached a spreadsheet, and I'd like to order the mean, standard deviation, and variance values as well as the filename.
I need advice on the strategy using the sample code I've attached below.
Thank you
filename = "sort_dataset.xlsx";
sheet = 1;
xlRange = 'A1:E253';
[num,txt,raw] = xlsread(filename,sheet,xlRange)

2 comentarios

Dyuman Joshi
Dyuman Joshi el 17 de Sept. de 2023
So you want to sort the data by mean and store the corresponding filenames, and do the same for standard deviation and variance?
If not, then please specify what is the output you want to obtain.
Life is Wonderful
Life is Wonderful el 17 de Sept. de 2023
Yes, you have understood the problem definition correctly.

Iniciar sesión para comentar.

 Respuesta aceptada

Image Analyst
Image Analyst el 17 de Sept. de 2023
Editada: Image Analyst el 17 de Sept. de 2023

1 voto

Try this:
filename = "sort_dataset.xlsx";
% Read data into a table variable.
t = readtable(filename)
% Sort table in order of increasing meandata
t2 = sortrows(t, 'meandata','ascend')
% Sort table in order of decreasing meandata
t3 = sortrows(t, 'meandata','descend')
% Sort table in order of increasing stdddata
t4 = sortrows(t, 'stdddata','ascend')
% Sort table in order of decreasing stdddata
t5 = sortrows(t, 'stdddata','descend')
% Sort table in order of increasing vardata
t6 = sortrows(t, 'vardata','ascend')
% Sort table in order of decreasing vardata
t7 = sortrows(t, 'vardata','descend')
% Sort table in order of increasing FileName
t8 = sortrows(t, 'FileName','ascend')
% Sort table in order of decreasing FileName
t9 = sortrows(t, 'FileName','descend')

8 comentarios

Life is Wonderful
Life is Wonderful el 17 de Sept. de 2023
perfect !!
Life is Wonderful
Life is Wonderful el 17 de Sept. de 2023
Editada: Life is Wonderful el 17 de Sept. de 2023
Please provide guidance on how to conduct Normal_distribution / normally_distributed, including mean and standard deviation, while keeping the filename.
3-sigma rule.
filename = "sort_dataset.xlsx";
% Read data into a table variable.
t = readtable(filename);
normdd2 = sortrows(t, 'meandata','ascend') + 3*sortrows(t, 'stdddata','ascend') % μ ± xσ, where x = [0.5:0.5:7]
I encounter the following issue when I attempt to do.
Error using +
Applying the function 'plus' to the variable 'FileName' generated an error.
Caused by:
Undefined function 'plus' for input arguments of type 'cell'.
Thank you !!
Image Analyst
Image Analyst el 17 de Sept. de 2023
Editada: Image Analyst el 17 de Sept. de 2023
Not sure what you mean but maybe this will help:
meanOfmeandata = mean(t.meandata)
stDevOfmeandata = std(t.meandata)
Also check out fitdist, lillietest, kstest, rmoutliers, etc.
Life is Wonderful
Life is Wonderful el 17 de Sept. de 2023
Editada: Life is Wonderful el 17 de Sept. de 2023
No, I don't want any more mean and standard deviation derivation. In fact, I have the final mean and standard deviation in a spread sheet, and I'm preparing the metric in such a way that I can classify the mean + standard deviation in ascending and descending order as you've shown me in the above code, so that my statistic follows the bell curve.
I have a statistic relating mean and standard deviation for a certain test case, which I am assuming is a file.
My issue is, for a given mean, if I am doing ascending order, how can I add the standard deviation to calculate the normal distribution? To put it another way, how can I execute two columns ascending order while retaining the filename?
I'm doing something similar to the code below, which is producing errors in my implementation.
nd2 = sortrows(t, ['meandata','ascend','stdddata','ascend'])
Image Analyst
Image Analyst el 17 de Sept. de 2023
"which I am assuming is a file." <== I thought you knew. You even attached a workbook file.
"for a given mean, if I am doing ascending order, how can I add the standard deviation" The order doesn't matter. Sorting is optional. To do the addition you can do
meanPlusSD = t.meandata + t.stdddata
"to calculate the normal distribution?" adding does not "calculate" a normal distribution. You should use fitdist on the original data (before the mean and SD were computed) if you want to fit the data to a normal distribution. The normal distribution is often not a good model in my experience. What are the measurements of? Can you show me the histogram of the original data so we can see if it's Gaussian shaped or not?
"how can I execute two columns ascending order while retaining the filename?" <== I already showed that in my original code where I sorted them by rows. The filename moved to the same row as the data.
Life is Wonderful
Life is Wonderful el 17 de Sept. de 2023
Editada: Life is Wonderful el 17 de Sept. de 2023
I'm adding a single data file where I computed the mean, variance, and standard deviation from the threshold column; similarly, I have other data files and perform the same thing.
Life is Wonderful
Life is Wonderful el 17 de Sept. de 2023
Editada: Life is Wonderful el 17 de Sept. de 2023
Histogram -Gaussian Fit
Zoom figure
Image Analyst
Image Analyst el 17 de Sept. de 2023
OK. Do you need anymore help? I think I answered all your questions.
If this Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Versión

R2023b

Preguntada:

el 17 de Sept. de 2023

Comentada:

el 17 de Sept. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by