Hey Vimala,
The error you're encountering is related to the output dimensions of the "MATLAB function" block.
In your code, you're trying to assign the output "y" to the result of the "rectangle" function, which doesn't return a numeric value but rather a handle to the rectangle object. This is likely causing the mismatch in expected output dimensions.
If your goal is to visualize a rectangle and not return any specific numeric output, you might want to adjust your function so that it doesn't attempt to return the handle.Here's a modified version of your function:
function fcn(a, b, c, d)
%#codegen
rectangle('Position', [a, b, c, d]);
axis([0 10 0 10]);
end
If you need to return some specific information about the rectangle, such as its position or size, you can adjust the function accordingly. Here's an example of returning the position vector:
function pos = fcn(a, b, c, d)
%#codegen
rectangle('Position', [a, b, c, d]);
axis([0 10 0 10]);
pos = [a, b, c, d]; % Return the position vector
end
Hope it helps.