How to calculate zero mean and unit variance for entire vectors in a folder?

조회 수: 1 (최근 30일)
krishnasri
krishnasri 2015년 6월 29일
댓글: Image Analyst 2015년 6월 29일
I am supposed to calculate zero mean and unit variance for a vector.These vector values are present in excel sheet.There are many such excel sheets in a folder, for all these excel sheets containing data for which I need to find out zero mean and unit variance are present in a folder. How can I write the code to calculate zero mean and unit variance for all these vectors in a folder at a time. Can u please help me with the code

답변 (1개)

Thorsten
Thorsten 2015년 6월 29일
1. Determine all excelfiles in the folder (hint: d = dir(',', '*.xls'))
2. loop over all these files and
3. read file (hint: D = xlsread(d(i).name);
4. compute mean and variance (hint: m = mean(D(:)), v = var(D(:));
5. exit loop if m == 0 && v == 1, in this case disp('found') (hint: break)
  댓글 수: 2
Greg Heath
Greg Heath 2015년 6월 29일
help zscore
doc zscore
help mapstd
doc mapstd
Hope this helps.
Thank you for formally accepting my answer
Greg
Image Analyst
Image Analyst 2015년 6월 29일
Greg, you put this in a comment, not an Answer so it can't be accepted. You should move it to an Answer.
krishnasri, you might find these entries in the FAQ helpful:

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

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by