Clear Filters
Clear Filters

Operator '*' is not supported for operands of type 'handle.handle'.

2 views (last 30 days)
I am using ActiveX to import data from an Excel file in an optimization model. There is one handle object created (Sigma variable in the code), is there anyway we can convert it to a matrix? (I got the error "Operator '*' is not supported for operands of type 'handle.handle'." for any math operations that I run).
Here is my code:
sheetname = sprintf('%d%d',k,x(k)) ;
exlSheet1 = exlFile.Sheets.Item(sheetname);
dat_range = ['A1:Y25']; % Read to the last row
sigma(:,:,k) = exlSheet1.Range(dat_range);
Temp = sigma(:,:,k)*2;
I appreciate your help in advance.

Accepted Answer

Walter Roberson
Walter Roberson on 4 Mar 2023
You have to use the Value property of the Range
sheetname = sprintf('%d%d',k,x(k)) ;
exlSheet1 = exlFile.Sheets.Item(sheetname);
dat_range = ['A1:Y25']; % Read to the last row
ex_range = exlSheet1.Range(dat_range);
sigma(:,:,k) = ex_range.Value;
Temp = sigma(:,:,k)*2;
Note: I have almost no practical experience with this, so I am going by what other people have posted.

More Answers (0)

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!