How to select specific rows of data from .mat file containing multiple column vectors

3 ビュー (過去 30 日間)
Qi Wang
Qi Wang 2023 年 3 月 22 日
回答済み: Stephen23 2023 年 3 月 22 日
I have a .mat file containning 36 column vectors, each column vector is 1000 rows*1 column. These column vectors are named as A_1, A_2, A_3, ..., A_36. How can I select data from rows 100 to 499 in these column vectors in batches?

回答 (2 件)

Marina Batlló RIus
Marina Batlló RIus 2023 年 3 月 22 日
You should use a for loop to get the data from each of the columns, and use cell callers to get the desired rows:
newdata = {}
for i in range(len(data))
newdata{i} = data{i}(100:499,:)
end

Stephen23
Stephen23 2023 年 3 月 22 日
F = 'name of your mat file';
S = load(F);
D = structfun(@(v)v(100:499),S, 'uni',0)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by