For Lopp data acquiring

조회 수: 4 (최근 30일)
aravindhnivas
aravindhnivas 2017년 9월 5일
댓글: KL 2017년 9월 6일
I want to load a data file (.dat) (No texts in the data file, only two data columns present) using load command and scatter(x,y). Now, I have a lot of data files so I need to write a loop script which assigns the variable with the filename.dat and then load it and scatter plot it repeatedly for all the .dat files present the directory.
Can you please help me since I am new to MATLAB.

채택된 답변

KL
KL 2017년 9월 5일
편집: KL 2017년 9월 5일
your_path = 'C:\Users\work\*.dat'; % your folder path
finfo = dir(your_path);
fnames = {finfo.name}';
for iCount = 1:numel(fnames)
data = dlmread(fnames{iCount});
figure
scatter(data(:,1),data(:,2));
title(fnames{iCount})
end
  댓글 수: 2
aravindhnivas
aravindhnivas 2017년 9월 5일
Thank you Sir/Madam. And is there any way to stop the popping up of plot so that i can simply send command get output??
I used to do this in unix script. I just submit the script the and it gives me all the output figures.
Thank you again.
KL
KL 2017년 9월 6일
I don't know how exactly are you calling this Matlab script/function. One idea is to hide the display of figures and save them all in a folder of your choice. Is that what you want to do?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by