Data extraction from multiple matfiles.

1 回表示 (過去 30 日間)
Shimelis Asfaw Wakigari
Shimelis Asfaw Wakigari 2019 年 2 月 21 日
Hello,
The following script loads all the files. The example of data is attached. I want to extract data for specific row and col for all the files i have (i.e., SM1,SM2,SM3,SM3). So i want code at commented place below in the script.
FileInfo=dir('SM*.mat');
for k= 1:length(FileInfo)
fileName=['SM' num2str(k)];
dataStruct.(fileName)=load([fileName '.mat']);
% This the place i want to have the way of extracting a pixel for all matfiles.
end
Thanks
  2 件のコメント
KSSV
KSSV 2019 年 2 月 21 日
How is the data stored in mat file? YOu extract the variable you want.
Kevin Chng
Kevin Chng 2019 年 2 月 22 日
It is better if you could upload the mat file here, and state what variable you want to extract.

サインインしてコメントする。

採用された回答

Kevin Chng
Kevin Chng 2019 年 2 月 22 日
Your Question:
I want to extract data for specific row and col for all the files i have (i.e., SM1,SM2,SM3,SM3).
For example, if you want to extract row 1 and column 2 from the variable in the mat file. Let assume that SM1 has variable sm1, SM2 has variable sm2,......
FileInfo=dir('SM*.mat');
for k= 1:length(FileInfo)
fileName=['sm' num2str(k)];
dataStruct=load(FileInfo(k).name);
% This the place i want to have the way of extracting a pixel for all matfiles.
dataStruct.(fileName)(1,2)
end
  1 件のコメント
Shimelis Asfaw Wakigari
Shimelis Asfaw Wakigari 2019 年 2 月 23 日
Thanks Kevin Ching!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWorkspace Variables and MAT-Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by