Hi to everybody, I created the file forward.dll using the command: mex -DWIN32 -output forward model_d.c model_s.c sdlib.c assigns.c contact.c derivs.c gmc.c impact.c inits.c invert.c lcp_solver.c lmdif_c.c mathtools.c object.c output.c pipetools.c readmuscles.c readtools.c sdfor.c spring_based.c wrapping.c gcvspl.c user_def.lib forward.lib acpp.lib qhull.lib solid.lib wrap.lib I need to run the command: set_param([subsystemname,'/','S-Function'],'function name','forward','parameters','[0],[0],[0],[0],[0],[0],[1 0 0 0 20],[0]'); ...

I am attempting to convert the attached Fortran source code (for a Laplacian five point smoothing filter) to a Matlab m-file. Within the attached Fortran code, there occasionally appears a Fortran convention known as an "S edit descriptor". For example, in line 14: SMFAC=FSM(I+1,J)+FSM(I,J-1)+FSM(I-1,J)+FSM(I,J+1)+1.S-5 In Fortran, the "S edit descriptor" restores the plus sign as optional for all subsequent positive numeric fields. It restores to the processor the discretion of producing plus characters on an optional basis. It takes the following form: S I can't f...

Hi! Using MatLab's 'movie' function you can play a movie recorded by the 'getframe' command. It is possible to specify the number of times the movie is played and the frames per second. Unfortunately, I've not found a way to stop the playback of a movie. Is it possible to, let's say I've specified the movie should be played 20 times, to disrupt the playback after an user interrupt?! Thanks a lot, Chris On Sat, 12 Feb 2005 10:40:06 +0100, Christoph ROLZ wrote: >Hi! > >Using MatLab's 'movie' function you can play a movie recorded by the >'getframe' command. It is possible to specify the number of times the >movie is played and the frames per second. > >Unfortunately, I've not found a way to stop the playback of a movie. > >Is it possible to, let's say I've specified the movie should be played >20 times, to disrupt the playback after an user interrupt?! > >Thanks a lot, > Chris if you want to play the movie, tried thi command index is the number of frame in video file. index = 1:100 mov = aviread('filename',index) for i = 1: 100 frame = mov(i).cdata; imshow(frame) end Please try it. ...

I have one question: Is Matlab's 'graycomatrix' function actually in accordance with original Haralick's 1973 paper? I mean, are they supposed to be the same algorithm? If yes, I don't think Matlab did a good job on this. For example, try it on this matrix (i.e., 'image'): 0 0 1 1 0 0 1 1 0 2 2 2 2 2 3 3 This matrix is in Haralick's original paper and the results can be compared. Can anybody ellaborate if you used it? Thank you. "Bulent Bayraktar" <bayrakta@purdue.edu> writes: > I have one question: Is Matlab's 'graycomatrix' function actually in > accordance with original Haralick's 1973 paper? > I mean, are they supposed to be the same algorithm? If yes, I don't > think Matlab did a good job on this. > > For example, try it on this matrix (i.e., 'image'): > 0 0 1 1 > 0 0 1 1 > 0 2 2 2 > 2 2 3 3 > > This matrix is in Haralick's original paper and the results can be > compared. > > Can anybody ellaborate if you used it? You do need to understand a bit about the conventions used in the software you are using. For example, the Image Processing Toolbox's default black-to-white range for double-precision inputs is [0, 1]. The reference page for graycomatrix describes in detail what it does. By default, for example, it quantizes the range [0, 1] into 8 levels, resulting in an 8-by-8 co-occurrence matrix. But for your matrix, it is seeing 5 &qu...

Simple question: I have a string like this 'blah blah [123] more blah 586 aavf', and I want to extract the number that's enclosed in '[' and ']'. I thought I can use findstr() to locate the position of '[' amd ']', then I use a substring function to get 123, but I can't find substring function in Matlab. Any thoughts? tline = 'blah blah [123] more blah 586 aavf'; ileft = findstr('[', tline); iright = findstr(']',tline); % now what the substring function that I can get something like substring(tt, ileft, iright)? thanks ...

Hi: In Fortran, one can use the INCLUDE statement to hide a piece of source code (stored externally in a text file) from the main program to enhance readability. In Matlab, how can I do that? What is wrong with a simple script? >> help script SCRIPT About MATLAB scripts and M-files. A SCRIPT file is an external file that contains a sequence of MATLAB statements. By typing the filename, subsequent MATLAB input is obtained from the file. SCRIPT files have a filename extension of ".m" and are often called "M-files". To make a SCRIPT fi...

I'm trying to write three shell scripts, which determine if the C/C++/Fortran compilers are GNU, Sun, IBM. HP etc. The code below is makes use of the C pre-processor and checks for what macros are defined. Can anyone give me a clue how I might do similar in Fortran? drkirkby@swan:[~] $ cat testcc #!/usr/bin/sh # Determine the type of C compiler, which can later # be used to determine the flags the compiler # will want. Do this by defining pre-processing a bit # of C code, and checking what are defined. # The Sun and GNU compilers have been tested. # The HP and GNU compilers have not been tested, but # use information gained from the documentation. # HP-UX C and C++ compiler. # http://docs.hp.com/en/7730/newhelp0610/preprocess.htm # IBM Compiler Reference - XL C/C++ for AIX, V10.1 # http://www-01.ibm.com/support/docview.wss?uid=swg27012860&aid=1 # Using HP C++ for Tru64 UNIX and Linux Alpha # http://h30097.www3.hp.com/cplus/ugu_impl.html#implem_chap # First, make sure the enviroment variable CC is defined. if [ -z "$CC" ]; then echo "Sorry, you should define the enivronment variable CC" exit 1 fi # Create a test file. It does not need to be a complete # C++ file, as it is only pre-processed. So there is no # need for a 'main' TESTFILE=/tmp/test.$$.c # The flags for the GNU compilers do not change with # operating system, so there is no need to worry too # much about what system this is on. echo "#ifdef __GNUC__&...

In IDL there is a function: execute(mystring) which will execute whatever command is contained within the string 'mystring'. This is very helpful, for example, when you are reading a file which has a list of variable names and associated data values. You would like to create MATLAB variables with the names listed in the file and assign the data values to these (initially unknown) variable names. Is there any way to do this in MATLAB? For this example, 'mystring' would be defined by something like: mystring=strcat(varname,'=data_array') Emily Riddle wrote: > >...

The current version of MATLAB, as far as one can see on the table presented on their pages, offers "support" (not maybe an exact term this) for Intel's fortran compiler v.10.1. Is it perhaps known when in the future versions v.11.0 will be supported ? I know it cannot be known for certain, but circa ... next version, second next from now ? With regards to all, Paul Paul Huber <phuber@invalid.com> wrote in message <oossd55julsqn3i9au2r4sup4elpnaih2c@4ax.com>... > The current version of MATLAB, as far as one can see on the table > presented on their pages, off...

I'm beginning to move a very simple set of php scripts from MySQL to Postgresql and want to know if Postgresql has anything like MySQL's rollup function. I use several scripts that pull out time and dollar data, break it out by time period and have a total at the bottom. Anything like that? I haven't stumbled across anything yet. thanks, r rloef@interfold.com wrote: > I'm beginning to move a very simple set of php scripts from MySQL to > Postgresql and want to know if Postgresql has anything like MySQL's > rollup function. I use several scripts that pull out time and dollar > data, break it out by time period and have a total at the bottom. > Anything like that? I haven't stumbled across anything yet. > > thanks, > > r > I'm not an expert of MySQL, but the documentation says that the "WITH ROLLUP modifier" of the GROUP BY clause in the SELECT statement gives you the kind of query result you described, that should be: 1999 $1500 2000 $1400 2001 $100 (Total) $3000 In PostgreSQL you could do this by using a UNION between 2 queries. Consider this: CREATE TABLE public.sales ( year varchar(4), --other fields, for example product name, customer code, ... price float4 --money is deprecated. For more precision, you should use NUMERIC ); (Now, insert some data...) And run the following query: SELECT year, SUM(price) FROM sales ...

FAIL: gfortran.dg/bind_c_usage_16.f03 -O0 execution test FAIL: gfortran.dg/bind_c_usage_16.f03 -O1 execution test FAIL: gfortran.dg/bind_c_usage_16.f03 -O2 execution test FAIL: gfortran.dg/bind_c_usage_16.f03 -O3 -fomit-frame-pointer execution test FAIL: gfortran.dg/bind_c_usage_16.f03 -O3 -fomit-frame-pointer - funroll-loops execution test FAIL: gfortran.dg/bind_c_usage_16.f03 -O3 -fomit-frame-pointer - funroll-all-loops -finline-functions execution test FAIL: gfortran.dg/bind_c_usage_16.f03 -O3 -g execution test FAIL: gfortran.dg/bind_c_usage_16.f03 -Os execution test all the...

Hi there, I've found several posts where people are experiencing this error "Output returned by S-function 'xxxxxxx' in 'xxxxxxx/S-Function' during flag=3 call must be a real vector of length 1" but I haven't been able to access a definitive solution. My m-files ran successfully with my previously installed version of Matlab/Simulink (i think V12 from 2000) but I've just upgraded to 2011a and now see this error. in InitializeSizes(u): sizes.NumOutputs = 1; sizes.NumInputs = 2; in Output(t,u): if u(2) == 0 u(2) = 1; end sys = u(1)/u(2); Does anyone have any hints? Is there a new syntax? cheers, Mel "Mel Cutler" <melcinasia@yahoo.co.nz> wrote in message news:iq7t6t$2ld$1@newscl01ah.mathworks.com... > Hi there, > > I've found several posts where people are experiencing this error > "Output returned by S-function 'xxxxxxx' in 'xxxxxxx/S-Function' during > flag=3 call must be a real vector of length 1" but I haven't been able to > access a definitive solution. > > My m-files ran successfully with my previously installed version of > Matlab/Simulink (i think V12 from 2000) but I've just upgraded to 2011a > and now see this error. > > in InitializeSizes(u): > sizes.NumOutputs = 1; > sizes.NumInputs = 2; > > in Output(t,u): > if u(2) == 0 > u(2) = 1; > end > sys = u(1)/u(2); > > Does anyone...

1) is there an equivalent of the "sparse" in fortran 90/95 2) is there a short-cut way of solving a system of linear equations (Ax=b) in fortran 90/95? Basically, i am looking for an equivalent of x=A\b. "Vinit Singh" <vinitsingh355@gmail.com> wrote in message news:<eef4ff7.-1@webx.raydaftYaTP>... > 1) is there an equivalent of the "sparse" in fortran 90/95 > > 2) is there a short-cut way of solving a system of linear equations > (Ax=b) in fortran 90/95? Basically, i am looking for an equivalent of > x=A\b. (1) The concept of sparse ...

Any body know if it is possible to use more than 1 fortran s-function as mex inside simulink model. I tried this by following command and got this error ___________________________________________________________ mex sfun_hyd_for.f interpolation.f simulink.f interpolation.obj : error LNK2005: _SIZES@4 already defined in sfun_hyd_for.obj interpolation.obj : error LNK2005: _INITCOND@4 already defined in sfun_hyd_for.obj interpolation.obj : error LNK2005: _DERIVS@16 already defined in sfun_hyd_for.obj interpolation.obj : error LNK2005: _OUTPUT@16 already defined in sfun_hyd_for.obj interpolati...

How to call a component's callback function in another component's callback function? I want to call popup menu's call back function in push button's call back function. What should I do and how? I will be grateful to you for you help! Thank you, Regards, Ahmed Just call it like you would any other function. The only thing you have to worry about is parsing arguments in the callback that is called from multiple sources. This example illustrates the difference: %---------------------------------------------------------------------------------------% function [] = call...

I must write in a file the array value. I'd like to have in file this format 1 value of element array(2) 2 value of element array(3) 3 value of element array(4) etc I wrote this code but I don't know get the up format. How can I have CR, In Language C I use \n. open(8, file='headm.txt') write(8,*) (i, headm(i) i=1,n+1) close(8) Ciobin wrote: > > I must write in a file the array value. > > I'd like to have in file this format > > 1 value of element array(2) > > 2 value of element array(3) > > 3 value of element array(4) > > etc > > I wrote this code but I don't know get the up format. How can I have CR, In > Language C I use \n. > > open(8, file='headm.txt') > > write(8,*) (i, headm(i) i=1,n+1) > > close(8) one way is do i i=1, iSizeOfHeadm write(*,*) i, headm(i) enddo > open(8, file='headm.txt') > write(8,*) (i, headm(i) i=1,n+1) > close(8) The easiest way is probably to write a real do loop (equivalent of a simple for loop in C): open(8, file='headm.txt') do i = 1, n+1 write(8,*) i, headm(i) end do close(8) -- FX You have two requirements, the first regarding which elements to write and the second regarding the arrangement of the output. There are two ways to do this. The first is to use a loop, so that each WRITE statement writes one line (the next write statement begins a new line): ...

I have a system described in differential equations and I have include the options in the differential equation solving, and I incorporated it in the s-function block and put it in the Simulink. Here are my options and ode solver options = odeset ('Mass',@xu_mass,'MassSingular','yes','MStateDependence','strong'); % odeset('MaxStep','1e-3'); % odeset('RelTol',1e-3,'AbsTol',1e-3); domain = 0:1e-4:8; [t,y]=ode23(@xu_eq,domain,[0;zeros(7,1)],options); However, I don't know where to add the options to the simulation. Please help. Thanks in advance! On 2=D4=C27=C8=D5, =C9=CF=CE=E710=CA=B120=B7=D6, workaholic <liua...@gmail.= com> wrote: > I have a system described in differential equations and I have include > the options in the differential equation solving, and I incorporated > it in the s-function block and put it in the Simulink. > > Here are my options and ode solver > options =3D odeset > ('Mass',@xu_mass,'MassSingular','yes','MStateDependence','strong'); > % odeset('MaxStep','1e-3'); > > % odeset('RelTol',1e-3,'AbsTol',1e-3); > domain =3D 0:1e-4:8; > [t,y]=3Dode23(@xu_eq,domain,[0;zeros(7,1)],options); > > However, I don't know where to add the options to the simulation. > Please help. > > Thanks in advance! Is there anyone who met such a problem? Thanks again in...

Hi all, I want to ask three questions regarding Fortran and Matlab interface. The two tools I am using are: Intel Visual Fortran 10.1 and Matlab 2006a. Q1. What is the best converter to convert Matlab code into Fortran code with readability? My understanding is that Fortran and Matlab are both vectorized and they should be pretty similar and such converter should do a good job. Q2. Is there a wizard for Intel Visual Fortran under MS Visual Studio.Net 2003 or Visual Studio.Net 2005 to set up environments for building mex dll file for Matlab on Windows XP? There is such a wizard tool for VC/C++, which is very convenient, just create a MEX project in Visual Studio and the compiled the result will be a mex dll for use in Matlab. I hope there is a similar tool for Fortran? Q3. Is there a tool to convert the Matlab code into Fortran with readability and then automatically make itself a mex dll? Thanks a lot! On Jul 6, 9:49 pm, "Linus Utopia" <linus_uto...@gmail.com> wrote: > Hi all, > > I want to ask three questions regarding Fortran and Matlab interface. The > two tools I am using are: Intel Visual Fortran 10.1 and Matlab 2006a. > > Q1. What is the best converter to convert Matlab code into Fortran code with > readability? My understanding is that Fortran and Matlab are both vectorized > and they should be pretty similar and such converter should do a good job. > > Q2. Is there a wizard for Intel Visual Fortran under ...

Hi everybody I have a serious problem and i need your help. i use embedded matlab function in simulink to generate some matrices which i use as input to other bloc on simulink. But i got this error while the simulation is running: Undefined function or variable 'y'. The first assignment to a local variable determines its class. Function 'Embedded MATLAB Function' (#52.384.385), line 19, column 2: "y" My code is function y = fcn(u) Ap=[0.9580 0 0 0;0 0.9418 0 0;0 0 0.9048 0;0 0 0 0.9277]; Bp=[0.25 0;0.25 0;0 0.5;0 0.5]; Cp=[0.1678 0 0.9516 0;0 0.2329 0 0.2890]; [m1,n1]=size(Cp); [n1,n_in]=size(Bp); A_e=eye(n1+m1,n1+m1); A_e(1:n1,1:n1)=Ap; A_e(n1+1:n1+m1,1:n1)=Cp*Ap; B_e=zeros(n1+m1,n_in); B_e(1:n1,:)=Bp; B_e(n1+1:n1+m1,:)=Cp*Bp; C_e=zeros(m1,n1+m1); C_e(:,n1+1:n1+m1)=eye(m1,m1); y(1:m1,:)=C_e; for kk=1:u-1; y((m1*kk)+1:m1*(kk+1),:)=y(m1*(kk-1)+1:m1*kk,:)*A_e; end thank you so much On 07/16/2014 5:50 AM, AGUEMON wrote: .... .... > ...i got this error while the simulation is > running: > > Undefined function or variable 'y'. The first assignment to a local > variable determines its class. > Function 'Embedded MATLAB Function' (#52.384.385), line 19, column 2: > "y" > .... > C_e(:,n1+1:n1+m1)=eye(m1,m1); > y(1:m1,:)=C_e; > > for kk=1:u-1; > y((m1*kk)+1:m1*(kk+1),:)=y(m1*(kk-1)+1:m1*kk,:)*A_e; .... Never used the em...

Hi all, Is there a program available that can convert a code in 'C' to 'Fortran'? I have a 'C' program (quite big) that I need to integrate into an existing 'Fortran' code. Can anyone give me a direction? Thanks in advance. Sam. Sam: http://home.cfl.rr.com/davegemini/C2F.ZIP Unzip and read the README.C2F text file. Skip On 10 Nov 2004 11:33:34 -0800, atluris@gmail.com (sam) wrote: -|Hi all, Is there a program available that can convert a code in 'C' to -|'Fortran'? I have a 'C' program (quite big) that I need to integrate -|into an...

Hi, Can anyone help me find a software that can convert a code in 'C' to 'Fortran77/90' automatically? Thanks in advance. Sam. sam wrote: > Hi, > Can anyone help me find a software that can convert a code in 'C' > to 'Fortran77/90' automatically? > > Thanks in advance. > > Sam. Wow, - good luck :) sam wrote: > Hi, > Can anyone help me find a software that can convert a code in 'C' > to 'Fortran77/90' automatically? This is not really on-topic. However, there is a slightly more topical version: Why...

Hi everyone, I'm trying to write code for the c2d function in Matlab - where the inputs are state matrices A, B, C, D, and a delta time-step. The outputs are [phi] and [gamma], the a and b matrices of the new, discrete state representation. I'm not sure where to start. Can anyone offer any suggestions? Thanks ...

I'm converting a Fortran program over to Matlab. I've done the conversion and the time domain part gives the same answers, but the frequency domain part does not. I've looked over each line and everything seems fine. So I began to suspect the sin, cos and tan functions. I created a table in Fortran and in Matlab, and indeed they do not match: From Fortran: sin cos tan 0.0 1.0 0.0 0 1.0 -0.0 -22877332 pi/2 -0.0 -1.0 0.0 pi -1.0 -0.0 22877332 -pi/2 0.0 -1.0 -0.0 -pi From Matlab: sin cos tan 0 1.00 0 0 1.00 0.00 16331239353195370.00 pi/2 0.00 -1.00 -0.00 pi -1.00 0.00 -16331239353195370.00 -pi/2 -0.00 -1.00 0.00 -pi where the column after tan is the value I plugged into the trig functions. I'm not seeing any pattern to the differences. Anyone know what the differences are between Fortran and Matlab trig functions, and how to 'correct it' in Matlab? Thanks [Tim] On Friday, September 14, 2012 7:41:08 AM UTC+12, Tim wrote: > I'm converting a Fortran program over...

i need to write some code in fortran ,and i have problem how to export function(i wrote funct) to fortran from matlab(m file).I'we read some about mexx but i dont understand all. If you need to keep your function in fortran for some reason, then mex is the way to go. Read more about it (go to the mathworks website). There are example functions and gateways in the help docs. Why not program in native matlab? Or convert it from fortran: http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=5260&objectType=file HTH, Ben Golubovic Goran wrote: > i need to write...

Resources last updated: 3/25/2016 9:54:40 AM