필터 지우기
필터 지우기

How to read the variable named sigma0 from multiple datas by using a loop ,where the datas are in h5 format?

조회 수: 1 (최근 30일)
Dataloc= '/home/ecsa_aleena/desktop/data cd(dataloc) Filename='/home/ecsa_aleena/desktop/data Dataset_name = 'science_data' Allfiles=dir(E06SCTL2A2023068_*.h5') Len =size(allfiles,1); Var=h5read(allfiles,'science_data/Sigma0');
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.
But the var command is showing error or is there other codes for creating a loop for finding the nanmean or mean of sigma0 for the multiple datas?
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 5월 16일
No, you do not get as far as the var command. Your code has invalid syntax, with a lot of places you do not close quoted strings.

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

답변 (1개)

Cris LaPierre
Cris LaPierre 2023년 5월 16일
MATLAB is case sensitive. Allfiles and allfiles are not the same thing.
Also, the first input to h5read must be a single file name, not a structure. If you have multiple files you would like to read in, I suggest looking into a filedatastore to load all the data into a single variable. You can see an example of how to use one to do this in this video from the Data Processing with MATLAB specialization on Coursera.
  댓글 수: 2
amrutha anna
amrutha anna 2023년 5월 17일
So while using h5read,how can i add 52 datas altogether,as i need the mean of these 52 datas? Is there any code for that
Cris LaPierre
Cris LaPierre 2023년 5월 17일
편집: Cris LaPierre 2023년 5월 17일
Add whatever processing you want to do to each file to your import function.
Here, that would mean having your import function read in the desired variable from the current file, then take the mean and assign that to the function output variable.
Write the code for a single file, then wrap it all up in a function, and use that as your import function.

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

카테고리

Help CenterFile Exchange에서 Environment and Settings에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by