Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Convert Code Containing Global Data to Fixed Point
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, I'm new to use the fixed point converter and HDL coder. I have a problem when I want to convert one of my model function to fixed point because this function is purely defining a global variable "PM" which contains all the parameters in my model. "PM" is a 1*1 structure global variable. I don't know how to convert this function in the fixed point converter. I checked the document for this issue but the situation is a little bit different. I'm using MATLAB 2014b but the document version might be older than this. Also the global variables in the document are not the same data type as mine. So I still can not solve my problems. Basically, my "PM" function is similar the the following, but there are more items in my real function.
%
function [PM]= Parameters(Test)
global PM
%%Constant
PM.R=8.314;
PM.F=96485;
%%Geometry
PM.L=27.6; % Length cm
PM.W=18.5; % Width cm
PM.d=1.47; % Thickness cm
PM.V=PM.L*PM.W*PM.d; % Volume cm
PM.layers=50; %%%%%%%%%%%%%%%Didn't provide%%%%%%%%%%%%%%%
PM.sandwichArea=Test*PM.L*PM.W*PM.layers;
end
Thanks.
0 comentarios
Respuestas (1)
Kiran Kintali
el 2 de Mayo de 2021
Use Persistent Variables instead of Global Variables when translating MATLAB to HDL Code. See doc and best practices in HDL Coder.
web(fullfile(docroot, 'hdlcoder/ug/persistent-variables-1.html?s_tid=doc_srchtitle'))
0 comentarios
La pregunta está cerrada.
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!