How do I return a range of cells as an output of an Excel Builder object in VBA function?
조회 수: 1 (최근 30일)
이전 댓글 표시
I am trying to fill an Excel cell array with the output of a function defined in my Excel Builder Component. I know how to place the output of the function in a single cell. However, I do not know how to fill an array of cells.
For example:
If I have the function in VBA:
Function foo(x1 As Variant) As Variant
Dim aClass As Object
Dim y As Variant 'output
aClass = CreateObject("mycomponent.myclass.1_0")
Call aClass.foo(1,y,x1)
foo = y
End Function
In Excel, I would like to pass the following range of cells into this function:
A1:1
A2:2
A3:3
and have it output to the range:
B1:B3
This is simple to implement if I used a VBA subfunction.
채택된 답변
MathWorks Support Team
2012년 9월 10일
You can return an array of cells from a MATLAB Excel Builder component by entering the formula as an array formula. This is accomplished by pressing CTRL+SHIFT+ENTER.
Select cells B1-B3, and enter the formula,
=foo(A1:A3)
Again to evaluate as an array formula, press CTRL+SHIFT+ENTER.
Consult the Excel documentation for more information on array formulas.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Export to MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!