How to use Improfile in a Function of a Simulink Model on MATLAB R2018B
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I am trying to use 'improfile()' to get the info of related pixels between two different points for a given 612x612 Matrix.(these points are not in a square sub-matrix so 'diag()' function is not usefull. ) It perfectly works in CommandWindow. When I try to run the same operation in a Matlab Function on Simulink, the porgram returns me the diagnostic below.
Function 'improfile' not supported for code generation. Function 'Proximity Sensor Feed-back' (#202.819.901), line 15, column 24: "improfile(Maze_Grayscale_Matrix,Proximity_Vector_Ahead_x,Proximity_Vector_Ahead_" Launch diagnostic report.
The code that I am trying to run:
function [Obstacle_Ahead ,Obstacle_Left ,Obstacle_Right]= Sensor(row,column,Maze_Grayscale_Matrix,x_origin,Ty,Tx,theta)
% Tx=0;
% Ty=0;
% theta=0;
% Maze_Grayscale_Matrix=rand(612);
% row=612;
% column=612;
% x_origin=322;
Initial_Camera_X_Column_Position=round(x_origin+Tx);%322
Initial_Camera_Y_Row_Position=round(row-2-Ty);%610
th = linspace( 0-theta, -pi-theta, 3); % Number and Position of Proximity Sensors on Robot
R = 15; %Proximity Sensor Range
x = max(1,min(column,round(R*cos(th) + Initial_Camera_X_Column_Position))); %Max Possible X Range point of each proximity sensor
y = max(1,min(row,round(R*sin(th) + Initial_Camera_Y_Row_Position)));%Max Possible Y Range point of each proximity sensor
%Proximity Sensor Front Feed-back
Proximity_Vector_Ahead_x=[x(2) Initial_Camera_X_Column_Position];
Proximity_Vector_Ahead_y=[y(2) Initial_Camera_Y_Row_Position];
Proximity_Vector_Ahead=improfile(Maze_Grayscale_Matrix,Proximity_Vector_Ahead_x,Proximity_Vector_Ahead_y);
Obstacle_Ahead =any(Proximity_Vector_Ahead (:)<255);
%Proximity Sensor Right Feed-back
Proximity_Vector_Right_x=[x(1) Initial_Camera_X_Column_Position];
Proximity_Vector_Right_y=[y(1) Initial_Camera_Y_Row_Position];
Proximity_Vector_Right=improfile(Maze_Grayscale_Matrix,Proximity_Vector_Right_x,Proximity_Vector_Right_y);
Obstacle_Right =any(Proximity_Vector_Right (:)<255);
%Proximity Sensor Left Feed-back
Proximity_Vector_Left_x=[x(3) Initial_Camera_X_Column_Position];
Proximity_Vector_Left_y=[y(3) Initial_Camera_Y_Row_Position];
Proximity_Vector_Left=improfile(Maze_Grayscale_Matrix,Proximity_Vector_Left_x,Proximity_Vector_Left_y);
Obstacle_Left =any(Proximity_Vector_Left (:)<255);
Are there any workaround that I can run 'improfile()' in a function in Simulink or any other method that can provide me the elements between two points(non-square) of a matrix?
Thanks in advance,
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Basic HDL Algorithms in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!