exchange data between matlab and excel video -凯发k8网页登录
exchange data between matlab® and microsoft® excel® and display the results back into excel. we create a diagonal matrix using the the spreadsheet link add-in or using a vba code and, finally, using matlab function wizard, which helps you learn how to use the matlab sub function.
in this video i am going to show you how to exchange data between matlab and ms excel in three different ways through an example.
- excel ribbon
- vba macro
- matlab function wizard
in a worksheet, enter the numbers 1 through 5 into the range of cells from a1 through e1.
define the name testdata for this range of cells.
on the home tab, click the matlab group then select send named ranges to matlab.
select run matlab command.
use the diag function to specify testdata as the input argument. d = diag(testdata)
select get data from matlab.
enter d in the dialog box to get the diagonal matrix.
spreadsheet link allows you to execute matlab functions in vba if you use macros to automate your data-processing calculation.
in the code section, enter this vba code that contains a macro named diagonal.
sub diagonal()
mlputranges
mlevalstring "b = diag(testdata);"
mlgetmatrix "b", "a3"
matlabrequest
end sub
this code sends the named ranges to matlab, creates the diagonal matrix, and places it at cell a3.
run the macro by clicking run, run sub/userform.
you can select matlab function wizard from the matlab group.
in the matlab command window, locate the diag function by entering which diag. choose the category matlab\elmat and function diag.
specify testdata as the input argument of v and the output cell a3. the diagonal matrix is placed at cell a3.
by double-clicking on the cell where it shows zero, you can learn the syntax of matlabsub function.
to recap, we have seen in this video how exchange and manipulate data in matlab from excel in three different ways. to find out more about the capabilities of spreadsheet link, please visit the spreadsheet link product page, where you can read the documentations, watch additional videos, and find examples. thank you for watching.
featured product
spreadsheet link
up next:
related videos:
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 mathworks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- (español)
- (english)
- (english)
欧洲
- (english)
- (english)
- (deutsch)
- (español)
- (english)
- (français)
- (english)
- (italiano)
- (english)
- (english)
- (english)
- (deutsch)
- (english)
- (english)
- switzerland
- (english)
亚太
- (english)
- (english)
- (english)
- 中国
- (日本語)
- (한국어)