avrgae and standDev... Data should be vector Problem??

조회 수: 1 (최근 30일)
ahmed
ahmed 2013년 10월 28일
댓글: ahmed 2013년 10월 29일
I am trying to plot the average and stand Dev for my lab data, I have like 8 text files (results), I did a loop to get all of them form file directory. Then import these data into matlab to able to work on them to obtain average values and StaDev. into plot.
each text file contains (3 C , 20 R). this the code to get the files form directory
dataDirectory = 'C:\Users\aam\Desktop\noies,';
allFilesDir = dir(fullfile(dataDirectory , '*.txt'));
allFN = {allFilesDir.name};
for n = 1:length(allFN)
Mat{n}=importdata(['' num2str(n) '.txt']);
end
now all files imported in matlab
I am tring to use :
for x=1:3
A(x)=(Mat{1,n}(1:20,x));
histfit(A,5)
xlabel('Noise (rms)');
ylabel('Sample Number');
[average,standdev] = normfit(A); % Fit of Distribution
end
but i got this In an assignment A(I) = B, the number of elements in B and I must be the same.
or data should be vector
histfit(Mat,5)
xlabel('Noise (rms)');
ylabel('Sample Number');
[average,standdev] = normfit(Mat); % Fit of Distribution
end
any ideass ???
  댓글 수: 2
Image Analyst
Image Analyst 2013년 10월 28일
You forgot to (1) attach your m-file, (2) attach a sample data file, and most importantly (3) give us the actual error message, not some snipped or paraphrased error message but ALL of the red text. As it is, we don't know which line of code caused the error.
ahmed
ahmed 2013년 10월 28일
Ok . I have 8 file named as (1:8).txt I am trying to automatize the plotting part using loop but I have a problem concerning using cell..

댓글을 달려면 로그인하십시오.

답변 (1개)

Image Analyst
Image Analyst 2013년 10월 28일
Why are you passing the entire cell array Mat into histfit()?
  댓글 수: 1
ahmed
ahmed 2013년 10월 29일
I want to do a loop to get the 'average,standdev' for all data in the text files in this sequence Ex ({1,8}(1:20,3))) ....

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by