How can I load variable data from some MATFfile into table?

Hello I'm beginner.
I have 20 MATfiles with different names, I want to load some data from 10 MATfile only into table. For example, in a MATfile there are variables :
date, month, year, tkp, tpp, etc...
And I want to load data date, month, year only from just 10 MATfile into table :
| No | Date | Month | Year |
| 1 | 01 | February | 2013 |
| 2 | 21 | Februari | 2013 |
............................
| 10 | 29 | Februari | 2013|
Please help me.

回答 (1 件)

Chandrasekhar
Chandrasekhar 2013 年 6 月 30 日

0 投票

matFiles = dir('*.mat'); table = []; for i = 1:length(matFiles) eval('load(matFiles(i))'); table{i,1} = num2str(i); table{i,2} = num2str(date); table{i,3} = month; table{i,4} = num2str(year); end

6 件のコメント

Indri Djon Hansemit
Indri Djon Hansemit 2013 年 6 月 30 日
I tried but get some error warning :
??? Error using ==> load
Argument must contain a string.
Error in ==> Menu_Rekap_Data>b_tampilkan_Callback at 81
eval('load(matFiles(i))');
what does it mean?
Chandrasekhar
Chandrasekhar 2013 年 6 月 30 日
could you please give me information about your mat file like matfile name and data in matfile
Chandrasekhar
Chandrasekhar 2013 年 6 月 30 日
remove the command
eval('load(matFiles(i))');
and use
str = matFiles(I).name; load(str);
I think this should work
Indri Djon Hansemit
Indri Djon Hansemit 2013 年 6 月 30 日
??? Undefined function or variable 'date'.
Error in ==> Menu_Rekap_Data>b_tampilkan_Callback at 84
uitable1{i,2} = num2str(date);
variable date, month, year are delare in other GUI and saved into MATfile. I always load data using "uigetfile". I don't know how to declare variablw without it.
And this project run when the user push the button, then data will display in the table, without searching in the directory..help me
Indri Djon Hansemit
Indri Djon Hansemit 2013 年 6 月 30 日
I have 20 MATfile in the same directory, I only need to load variable from these bellow : (MATfile name)
JUM01022013, KAM21022013, JUM22022013, ,.. (only 10)
each file contains variable :
date, month, year, tkp, tpp,...
I make another GUI, contain 1 pushbutton and 1 uitable. And I hope when I push the button, the table will display like what I describe before...
I really counfuse..please hell me..
Chandrasekhar
Chandrasekhar 2013 年 6 月 30 日
i'm unable to guess how your data looks like.. can u send me the screen shot of the data. or send mat file to me if possible. I can give the solution

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

カテゴリ

ヘルプ センター および File ExchangeWorkspace Variables and MAT Files についてさらに検索

質問済み:

2013 年 6 月 30 日

Community Treasure Hunt

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

Start Hunting!

Translated by