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

 채택된 답변

Tom
Tom 2013년 6월 23일

0 개 추천

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

댓글 수: 3

Virginia
Virginia 2013년 6월 23일
편집: Virginia 2013년 6월 23일
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?
Tom
Tom 2013년 6월 23일
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 2013년 6월 23일
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!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

질문:

2013년 6월 23일

Community Treasure Hunt

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

Start Hunting!

Translated by