Importing data from excel in matlab gui

I have made a gui which has 11 variables and a push button which calculates a property based on the input values (neural network). I have around 100 data sets for these 11 variables (in excel) and want to predict the output property for each data set. Doing this manually is time consuming. Is there an easy way out? Please help.

4 件のコメント

Al Dente
Al Dente 2015 年 8 月 5 日
help xlsread
PRITESH GARG
PRITESH GARG 2015 年 8 月 5 日
xlsread will import for a particular data set. I need it to be done for all the 100 data sets in one go. With xlsread I will have to change the cell details everytime.
Al Dente
Al Dente 2015 年 8 月 5 日
編集済み: Al Dente 2015 年 8 月 5 日
have all your excel files in one directory, then:
cd c:\myexcelfilesdirectory % that's the directory that you created for the files
z = dir;
z = {z(3:end).name}; % z(1) is \. z(2) is \..
[num,txt,raw] = cellfun(@(x)xlsread(x), z, 'UniformOutput', 0)
that would read them all at once, will take a while though, you can always loop through them with a for loop instead.
PRITESH GARG
PRITESH GARG 2015 年 8 月 6 日
I have just one excel file. In that there are around 100 rows with 11 columns(variables). Each row is a data set consisting of 11 variables and I have a gui built to calculate the output depending on these 11 variables. This way I will get 100 outputs (one each for a row). I just need to calculate this in one go.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 8 月 6 日

0 投票

Read the file.
Repeat
fetch a row. set() the appropriate handles to contain the values extracted from the row. call the callback routine for the button that activates the calculation, passing in the handle of the button, then [], then the handles structure
pushbutton1_callback(handles.pushbutton1, [], handles)
The calculation will be run.
Do whatever you need to do afterwards. That might include get()'ing the 'String' of a handle to write out to a file.
End of loop.

タグ

質問済み:

2015 年 8 月 5 日

回答済み:

2015 年 8 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by