Matlab R2013a Invalid field name 'NumConStates'
I created a model in Matlab R2011a Simulink and it was working fine but now when i want to open it in Matlab R2013a Simulink I have this error.
Error in 'wahadlo/Subsystem/SFunction' while executing MATLAB Sfunction 'wahadlo_sfun', flag = 0 (initialize), at start of simulation.
Caused by:
Invalid field name 'NumConStates'.
I could't find any solution to this problem. Here's my Simulink Model
See also questions close to this topic

Could you explain why this matrix read as a scalar/vector when using surf? Also, is reshaping necessary?
To preface I am not familiar with Matlab, sorry for any obvious or stupid mistakes.
ThesisBluePhase3Data1360 has three columns of 1210 values. I look at my workspace and can see that x is a 1210x1 double matrix.
Despite this, running the code below returns Error using surf (line 82) Z must be a matrix, not a scalar or vector. %Why does this happen?
Error in Untitled (line 9) surf(x,y,z1,'EdgeColor','none')
Note: I've commented the reshape values because I was getting this error and I see why the matrices actually need to be resized (please correct me if I'm wrong). My intent is to use surf2stl once I understand these issues.
Code in question
x = ThesisBluephase3Ddata1360.x; y = ThesisBluephase3Ddata1360.y; z = ThesisBluephase3Ddata1360.z; %x = reshape(x,39,31); %y = reshape(y,39,31); %z = reshape(z,39,31); z1=(5.4/4.83).*z; figure(3); surf(x,y,z1,'EdgeColor','none') hold on contour3(x,y,z1,0,'k') hold off xlabel('x') ylabel('y') zlim([0 2000]) zlabel('Irradiance (mW/cm^2)') title('Bluephase'); colorbar caxis([0 2000]) rotate3d on;
Thank you for your time!

convex optimization without function values
Suppose I have a function whose values are hard to compute, while the gradient and Hessian are easy, and I am trying to optimize it on a convex polytope. Here is an example:
let g(x) =  integral from 0 to x of log(sin(t)) dt.
Now, we want to find the argmin of G(a, b, c) = g(a) + g(b) + g(c) on the polytope a, b, c >= 0, a+b+c = pi.
Notice that the gradient and the Hessian can be easily expressed in terms of elementary functions, and I don't really care about the value of the function at the argmin (in any case, it is easy to compute if you are only computing it once). Since, presumably, Newton's method type solvers will not be computing the function values anyhow, there should be a way to not have to specify the function.

How to generate the same values in python like in matlab
Just running some plots in matlab and I am using the following code
t = [3:0.001:3];
to generate t values for a plot of t,y, how would you do this in python as I am converting to it later this year?

extended kalman filter for state of charge estimation, simulink block
i am estimating state of charge for lithiumion batteries using extended kalman filter. i need to know how to implement state space equation in Simulink function. please help?

How to modify the mechanical input of a Simscape model during simulation?
I'd like to modify the physical input of my Simscape model during the simulation but I don't know how to do it.
The mechanical translation block in the picture below is used to convert the rotational input into a translational movement (by mean of a pinion and rack mechanism). The rack is then connected to the rod of a piston. As the piston moves, it compresses a hydraulic fluid in a reservoir (not displayed below for sake of clarity). The physical input of the model is an ideal rotational velocity source.
For now, the whole compression process happens for 1 second and then the pressure in the circuit can't drop as the input velocity is set to zero (signal 2 is a pulse).
What I would like to do however is to compress the fluid for a given amount of time and then remove any conditions on the input shaft so that it can rotate freely as to simulate the decompression in the hydraulic circuit.
Better : remove the condition when the pressure in the circuit has reached a given value.
How can I accomplish that in Simulink ? What block shall I use for that purpose ?
Thanks.

Reading a char array of an SFunction Parameter
I am having trouble reading a string (file name : 'aFile.csv') from SFunction parameter. The error I get doesn't make sense to me
I am using MSVC++(2017).
The error appears to come from ssGetSFcParam inside mxGetString
Here is a snippet of the code that has the proble (in the mdlStart method)
static void mdlStart(SimStruct *S) { FILE* fp; char buffer[255]; char* fileStr; char* paramStr; int_T fstatus; int_T pstatus; const int_T flen = (int_T)mxGetN((ssGetSFcnParam(S, 0)))*sizeof(char)+1; const int_T plen = (int_T)mxGetN((ssGetSFcnParam(S, 1)))*sizeof(char)+1; fileStr = mxMalloc(flen); paramStr = mxMalloc(plen); fstatus = mxGetString((ssGetSFcParam(S,0)),fileStr,flen); pstatus = mxGetString((ssGetSFcParam(S,1)),paramStr,plen); real_T* Defval = (real_T *)mxGetData(PARAM_DEF2(S)); fp = fopen(fileStr, "r"); // additional code here, but has nothing to do with the error mxFree(flen); mxFree(plen); fclose(fp); }
Error using mex
Creating library FileReader.lib and object FileReader.exp FileReader.obj : error LNK2019: unresolved external symbol ssGetSFcParam referenced in function mdlStart FileReader.mexw64 : fatal error LNK1120: 1 unresolved externals