Can anyone please correct this code for me?
이전 댓글 표시
Hi,
I am trying to extract data from a sequence of files. I also need to extract the value of x that corresponds to peak y value from each plot. I have tried the following code but I can't get results. I would be grateful if someone can check it for me. I have attached herewith the files for your kind reference.
close all; clear all; clc;
folder = cd;
for k = 1:2;
for j = 1:2;
matFilenameA = sprintf('X%d.out', k);
matData1 = load(fullfile(cd, matFilenameA));
%
matFilenameB = sprintf('Y%d.out', j);
matData2 = load(fullfile(cd, matFilenameB));
x = matFilenameA(:,2);
y = matFilenameB(:,2);
[maxvaly,idx] = max(y) ;
maxvalx = x(idx);
fid=fclose('all');
end
end
댓글 수: 4
Birdman
2017년 11월 11일
In which part of code do you have trouble?
Ismail Qeshta
2017년 11월 11일
Birdman
2017년 11월 11일
You do not assign numerical arrays to x and y. I think you should write
x= matData1(:,2);
y= matData2(:,2);
Ismail Qeshta
2017년 11월 11일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!