Manipulate Excel from Matlab

Hi, I want to know how can develope a code so it open phisically an Excel file, and then save the selected cell range that I'll selected with the mouse as a matrix in Matlab

 Risposta accettata

Tom
Tom il 23 Giu 2013
The -1 field allows you to use Excel interactively.
[num txt raw] = xlsread(fileName,-1);

3 Commenti

Virginia
Virginia il 23 Giu 2013
Modificato: Virginia il 23 Giu 2013
Sorry, as I said, I'm new at this, I want to convert the answer this gives me to a matrix, right now it shows like this with your suggestion
[ 5.2343e+04] [-2.7790e+04] [ 3.1647e+03] [ -193.0416]
[-2.7790e+04] [ 4.9210e+04] [-2.7469e+04] [ 2.8949e+03]
[ 3.1647e+03] [-2.7469e+04] [ 4.8519e+04] [-2.3946e+04]
[ -193.0416] [ 2.8949e+03] [-2.3946e+04] [ 2.1198e+04]
And I want it to be showed as a Matrix for example
1.0e+04 *
5.2343 -2.7790 0.3165 -0.0193
-2.7790 4.9210 -2.7469 0.2895
0.3165 -2.7469 4.8519 -2.3946
-0.0193 0.2895 -2.3946 2.1198
Is there a command to convert this? or any other way to do it?
I think you're looking at the raw data, rather than the numeric data (see the three outputs you get from XLSREAD)?
Otherwise, try:
cell2mat(data)
Virginia
Virginia il 23 Giu 2013
I just did it, I just had to set the name of the variable for example
[K] = xlsread(comp,-1)
And that will save the range cell in matlab.
Thanks Tom!

Accedi per commentare.

Più risposte (0)

Categorie

Community Treasure Hunt

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

Start Hunting!

Translated by