MATLAB Importing .dat individually to be looped for a mean plot

조회 수: 1 (최근 30일)
Rutledge Fogel
Rutledge Fogel 2021년 4월 15일
답변: Swetha Polemoni 2021년 4월 18일
I have 30 .dat files each measured at a different alpha value that have data that needs to be plugged into the pressure coefficent equation to find the mean, then plotted against the x/c value which is just another equation that has data within the .dat files. I know a for loop is possible to extract the values I need from each file individually then another one to then plug them into a certain equation then take the mean. Any help would be appreciated in how to loop data extraction for individual files. the names of the file go from alpha__6 which is alfa -6, to alpha_24, which is an alfa of 24. Thank yu.

답변 (1개)

Swetha Polemoni
Swetha Polemoni 2021년 4월 18일
Hi
It is myunderstanding that you want to read more than one .dat file using for loop. Following code snippet might help.
for i =6:64
filename=['alpha__' num2str(i) '.dat'];
file= fopen(filename,'r');
end

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by