필터 지우기
필터 지우기

converting matlab output to txt format

조회 수: 1 (최근 30일)
lamawal Jonathan
lamawal Jonathan 2014년 12월 2일
댓글: lamawal Jonathan 2014년 12월 4일
Hi people, pls help; i wrote a matlab program to find the logarithm of the average of a signal energy for twenty(20) different audio files. for each session of my code, i saved my output as 'E'and matlab display E=.... for all different 20 audio files. but what i want is for matlab to display my answer together as a [20,1] matrix. that is E=.......... for all 20 answers instead of displaying individual answer. does anyone know if it is possible for me to achieve this? secondly, is it possible to automatically convert my output to txt format? i will appreciate any assistants. thanks

채택된 답변

Stephen23
Stephen23 2014년 12월 4일
Alternatively the data can be written straight away, without saving it in an intermediate matrix:
fid = fopen(filename);
for k = 1:20
... read file
... calculate energy
fprintf(fid,...)
end
flcose(fid)

추가 답변 (1개)

Geoff Hayes
Geoff Hayes 2014년 12월 2일
Iamawal - if you have a program to find the log of the average signal energy for 20 audio files, then you must be using a for loop to do this. If this is the case, then just create a matrix for this output prior to iterating. Then, on each iteration, store the energy in this matrix. Something like
E = zeros(20,1);
for k=1:20
% read the audio file
% calculate the energy
% save to the matrix
E(k,1) = ...;
end
Now you can display the 20 values or write to file. If the latter, then use fopen to open a file, fprintf to write the data to file, and fclose to close the file.
  댓글 수: 5
Geoff Hayes
Geoff Hayes 2014년 12월 4일
Iamawal - please don't post the same question in two different places. Your question at http://www.mathworks.com/matlabcentral/answers/165348-k-fold-validation-speech-recognition should be sufficient.
lamawal Jonathan
lamawal Jonathan 2014년 12월 4일
ok

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

카테고리

Help CenterFile Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by