开发者

Using get_param in simulink returns an array

开发者 https://www.devze.com 2023-02-26 05:43 出处:网络
I have an S-Function called mxsf. When I run the following command: mxhandle = get_param(mxsf, \'Handle\')

I have an S-Function called mxsf. When I run the following command:

mxhandle = get_param(mxsf, 'Handle')

I get the handle returned of course, but it returns it as [88.0012] instead of 88.0012. I have an in-house .NET library for interfacing with matlab/Simulink, and we have a function that is supposed to get the double of a variable inside Simulink, but it won't work if the double开发者_如何学编程 is between brackets. How do I make get_param return the handle without sticking it in an array? It is also worthy to note that this does not always happen (sometimes get_param will get a handle without putting it in an array, but I don't know how to force this). Any help on this would be greatly appreciated.


I can't get add_block() to return the block path as a string, it keeps returning a double (Simulink block handle maybe?). What's your add_block() calling syntax?

My guess is that add_block() is returning a cell array containing the block path and so get_param() returns an array. Try

mxhandle = get_param(mxsf{1}, 'Handle')
0

精彩评论

暂无评论...
验证码 换一张
取 消