Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register
  • Index
  • » Users
  • » Cannavacciuolo
  • » Profile

Posts

Posts

do i have to change something in the function?

hi.. I would like to load a modelica model in Matlab. Does anyone can help me? How can I use this function?




function omimport(modelname) 
%
% Read OpenModelica Result File into Workspace
%
% SYNTAX: omimport(modelname)
% z.B. omimport('package.model')
%
% Feedback/problems: Christian Schaad, ingenieurbuero@christian-schaad.de

load ([modelname,'_res.mat']);
%Sort out double times
deltat0=find(diff(data_2(1,current/smile)==0);
disp(['Removed same time values: ',num2str(length(deltat0)),'/',num2str(length(data_2(1,current/smile))])
assignin('base','data_2',data_2);
assignin('base','dataInfo',dataInfo);
assignin('base','name',name);
assignin('base','deltat0',deltat0);
name=name';
for i=1:length(name)
if (isempty(strfind(name(i,current/smile,'der(')))         
nonchars=strfind(name(i,current/smile,char(0));
if dataInfo(2,i)<0;
assignin('base','temp',-data_2(-dataInfo(2,i),current/smile);
else
assignin('base','temp',data_2(dataInfo(2,i),current/smile);
end
evalin('base',(['temp(deltat0)=[];']));
evalin('base',([num2str(name(i,1:nonchars(1)-1)),'=temp;']));

end
end
clear data_1 data_2 Aclass description modelname i dataInfo temp deltat0;
evalin('base',(['clear name data_2 dataInfo nonchars temp']));

  • Index
  • » Users
  • » Cannavacciuolo
  • » Profile
You are here: