Setting Look Up Table parameter ‘Table’ from GUI using set_param

I want to set the LUT parameter ‘Table’ frm a GUI:

Lookup Table (n-D): ….. simulink library block

Table data: wArray
Breakpoints 1: ........

I am writing the following code in edit callback in GUI:

wNewVal = str2double(get(hObject,'String')); 
w=wNewVal;
wArray=[w w 0 0 -1*w -1*w 0 0]
set_param('SDH/Tp/w','Table','wArray')

i can run the code without any errors but if i run my simulation..i get the following error:

Error evaluating parameter 'Table' in 'SDH/Tp/w'Caused by:
Undefined function or variable 'wArray'.

See this also:

get_param('SDH/Tp/w','Table')ans =wArray

ANSWER

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

Prashant Kumar answered . 2021–10–11

The code in the GUI Callback creates variables in the callback function workspace. Do you run the simulation from the function or independently? If you run it using the SIM command from the function, use this syntax:

options = simset('SrcWorkspace','current','DstWorkspace','current');
sim('mymdl', [0 duration], options)

Otherwise, make sure that the variable ‘wArray’ is created in the base workspace, because that’s where the model looks for it:

wNewVal = str2double(get(hObject,'String')); 
w=wNewVal;
wArray=[w w 0 0 -1*w -1*w 0 0];
assignin('base', 'wArray', wArray);
set_param('SDH/Tp/w','Table','wArray')

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Technical Source

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.