Réponse apportée
Make a new variable based on data in the cell array.
x=[1 2 3 0 0 6] x=x(logical(x))

environ 3 ans il y a | 1

Réponse apportée
Make a new variable based on data in the cell array.
x=[1 2 3 0 0 6] x=x(x~=0)

environ 3 ans il y a | 1

Réponse apportée
Make a new variable based on data in the cell array.
x=[1 2 3 0 0 6] x=nonzeros(x)'

environ 3 ans il y a | 1

| A accepté

Réponse apportée
Regression curve fitting for a given equation
p=polyfit(x,y,1); From this, you immediately obtain y0=p(2). For the remaining parameters, you can choose any of the infinite s...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
Finding optimal parameters of a conjoined distribution of N variables over given data with fminsearch
To answer your question, you wouldn't define J using a loop at all. Your f(x) are vectorized over the measured data vector y, so...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
How can assign numbers between two integer numbers instead of ones in a [0 1] matrix?
Sure. randi([lower,upper], 6,5)

environ 3 ans il y a | 0

Réponse apportée
Plotting grouped 3D bars from 3D matrix
Perhaps as follows: z=rand(5,4,5);%Fake data numDelta=size(z,3); clear xtk for i=1:numDelta h=bar3(z(:,:,i...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
How to find files containing two words with an extension.
Remove the extra asterisk: filename = dir('*pa750*mask*.mat')

environ 3 ans il y a | 1

Réponse apportée
Is it possible to show two .fig files in the same figure?
I am able to display two .fig files in the same figure as in the code below (like hold on function). When you use hold on/off, ...

environ 3 ans il y a | 0

Réponse apportée
rotate polar angle by an arbitrary angle
THETA0=THETA0-beta;

environ 3 ans il y a | 0

| A accepté

Réponse apportée
Why I'm getting a complex degree value while using "acos"?
Because abs(dir_mag2/dir_mag1) is greater than 1. abs(dir_mag2/dir_mag1)

environ 3 ans il y a | 0

| A accepté

Réponse apportée
fminsearch gives weird zick zack solution
It seems unlikely to me that x0=[1,1,1] would be an accurate initial guess. Surely, you chose that arbitrarily. Since you only h...

environ 3 ans il y a | 0

Réponse apportée
gernerating standard normal variable in matlab
at what value of n will i get the value close to identity? Well, with your current code, z will always contain only ones, so th...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
Why am I getting Empty sym: 0-by-1, everything in SYMS is just equal to itself, the eqn1 is working properly comparing the correct things, but not working properly, pleasehelp
Look at your first equation. You have Vb set to 3 different literal constants. How can those equalities be simultaneously satisf...

environ 3 ans il y a | 0

Réponse apportée
How best to overlay bar graphs from histcounts of different data?
A solution with interlacing: [v1, e1] = histcounts([2 5 3.4 5.3 5 4 8 7],linspace(3,6,4)); [v2, e2] = histcounts([3.4 5.5 6.4 ...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
How best to overlay bar graphs from histcounts of different data?
Maybe make the bars semi-transparent? You can also play with the edge thicknesses to emphasize the area of inclusivity of the ba...

environ 3 ans il y a | 1

Réponse apportée
Dot notation and curly braces with TABLE
In Matlab, there are circumstances in which indexed assignments will convert the type of the right hand side in order to be cons...

environ 3 ans il y a | 0

Réponse apportée
Unwanted black background on a figure
I have no idea why it's like this. That seems to be the default color scheme, judging from this doc page, https://www.mathwork...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
if loop to find values in a variable
One possibility t = [4 5 7 8 10 11 12 15 17 20 22 24 26 27 28]; Q = [1 3 4 1 5 8 4 2 6 1 4 2 8 3 5]; p = 10; np = 3; c ...

environ 3 ans il y a | 0

Réponse apportée
Is there a way to speed up the computation of a piecewise defined function?
Use logical indexing, %Option 1.1 x=-10:10; y=x; y(x<=-5)=-2; p=abs(x)<5; y(p)=sin(x(p)); struct.x=x; struct.y=y;...

environ 3 ans il y a | 0

Réponse apportée
After migrating from MATLAB 2020b to 2023a my cpp application can't load mcc DLL
It sounds like your code is linking to the 2020b Matlab Runtime, instead of the newer one. If you know how to adjust that, you p...

environ 3 ans il y a | 0

Réponse apportée
Find values of two variables corresponding to query points of two matrices.
You should use fsolve or fminsearch to solve the original equations. Both of these are iterative solvers requiring an initial gu...

environ 3 ans il y a | 0

Réponse apportée
fminbnd error in calculating of solar cell efficiency with detailed balance
Perhaps you meant to have, F = @(V) norm( V.*-q.*(Nabs - Fluxfunction(Eg, Egmax, Tc,V)) ); Otherwise, it is not clear how t...

environ 3 ans il y a | 0

| A accepté

Réponse apportée
Using different line style to generate plot
N = 10:20:500; err = rand(6,numel(N)); %fake h = loglog(N,err'); [h.LineStyle]=deal('-','--','-.',':','--','--'); [h(end-1...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
Function in MATLAB's path not call-able by another function in MATLAB's path despite both functions being call-able in Command Window
Possibly mproc or one of its callers has path-altering commands that temporarily remove cmap from the path. To be certain, we wo...

environ 3 ans il y a | 0

Réponse apportée
Error using pcread and pcshow
I wouldn't know how to do all the image processing and segmentation work that I could do in a simpler and more direct way with t...

environ 3 ans il y a | 0

Réponse apportée
How do I fix "Index exceeds the number of array elements"?
Well, period=50 so x1(period+1:2*period) is the same as x1(51:100). Since x1 has length 50, indexing it from 51:100 won't work. ...

environ 3 ans il y a | 0

Réponse apportée
Function in MATLAB's path not call-able by another function in MATLAB's path despite both functions being call-able in Command Window
So this specific line of code is just refusing to work for seemingly no reason. Maybe there is some invisible character in tha...

environ 3 ans il y a | 0

Réponse apportée
Can I use parfeval in App Designer to plot to a UIAxes while the code keeps running?
A mechanism equivalent to .mat file saving is how data is transferred to parpool workers. The plotFcn that you give to parfeval ...

environ 3 ans il y a | 1

| A accepté

Réponse apportée
have an array of inputs instead of constants
Just concatenate all the constants into a vector and bring that into Simulink, constants=[m,alp_ang,...,MaxBrk]

environ 3 ans il y a | 1

Charger plus