This functionality does not exist as a builtin command in MATLAB 7.6 (R2008a). However it can be easily implemented by, for example, this function:
function mData = fcm(data, lookup_value)
dist = abs(data(:,1)-lookup_value);
[min_val, min_loc] = min(dist);
if data(min_loc,1)<=lookup_value
mData = data(min_loc,2);
else
try
mData = data(min_loc-1,2);
catch ME
if ME.identifier=='MATLAB:badsubscript',
error('The lookup_value must be greater than the smallest value in 1st column of the lookup array'),end
mData=NaN;
end
end
This function returns an error if the lookup_value is smaller than the smallest number in the 1st column of the lookup array.
Note that if you are using the data type table you can achieve this kind of functionality by accessing the value via the row name ( T.Value('rowname')).
Best Answer