Use of vlookup function results in "Improper assignment with rectangular empty matrix" Error

2 views (last 30 days)
I am in the process of creating a GUI that will take inputs (values between 0 and 1) and using the vlookup function written by Zhiqiang Zhang (<http://www.mathworks.com/matlabcentral/fileexchange/29233-vlookup-similar-to-ms-excel-function/content/vlookup.m>) will output values from the third column of an invisible matrix in the GUI.
Here is a portion of the code that results in the error "Improper assignment with a rectangular matrix": XLookupTable has three columns: "Index", "C/Co", and "X". PRCRatios is a callback from a pushbutton. The goal is to lookup the PRCRatios values in Column 2 of XLookupTable and report the X values in the matrix "x_matrix".
% Call Lookup table & use C/Co values to get x from lookup table
L = get(handles.XLookupTable,'data');
k = length(PRCRatios);
for j = 1:k
content3(j) = vlookup3(L,PRCRatios(j),2,3)
end
x_matrix = transpose(content3)
Here is the code for the XLookupTable:
index = 0:700000;
xlookupCol1 = index.*0.001;
xlookupCol2 = exp(xlookupCol1).*erfc(sqrt(xlookupCol1));
xlookup =transpose([index;xlookupCol2;xlookupCol1]);
Please let me know if you have any ideas/suggestions about how to rework the code to avoid this error. Thank you!

Answers (0)

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!