Export data from matlab to excel file

조회 수: 6 (최근 30일)
Lisa
Lisa 2014년 5월 22일
편집: Lisa 2014년 6월 17일
I'm creating a function that takes arguments in matlab. I already have a excel file with names and numbers but i want to change the number for and want matlab to write over the old number how do I write the function so that it overwrites the right field in the excel file? I don't want to name the field in the function since the function should work for any of the names....
  댓글 수: 1
Image Analyst
Image Analyst 2014년 6월 17일
Explain your edit on June 17 - I don't know what you changed.

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

답변 (2개)

Mahdi
Mahdi 2014년 5월 22일
You can use the xlswrite built-in MATLAB function and specify the file you want to write and the column/row where it should write a value.
  댓글 수: 1
Lisa
Lisa 2014년 5월 22일
Yes, I have tried to use the xlswrite function and then specifying the range with xlRange. But the problem is I don't know how to specify the field, I want to write it to column 2 but which row it is depends on which name I put in as an argument. And by the way, how do I even use a name as an argument?

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


Image Analyst
Image Analyst 2014년 5월 22일
You have to call xlsread() first. Then use ismember() to find out where the name occurs in the existing file. Then use the third argument in xlswrite() to write the data to the particular cell where it needs to go.
  댓글 수: 3
BSantos
BSantos 2014년 5월 23일
I believe you may need to pass your variable as a string.
Image Analyst
Image Analyst 2014년 5월 23일
Correct. And also you need to use the output of ismember to find out what row 'Eric' resides at. You're also not using xlsread() or xlswrite() correctly. Please look at the help for those functions, plus ismember(), to find out how to do it. I can tell that you have not done that yet or you would not have code that looks anything like that. Also, newbalance is not defined. You didn't pass it in, or define it in the ChangeNumber() function.

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

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by