Attempt to execute SCRIPT ... as a function:
What do you mean by '10' on this line testfunktion(10) To call a script, you just need to type the script name testfunktion ...

4 días ago | 1

Transfer function, G
's' is not defined by default in MATLAB. You need Control system toolbox to create a transfer function. Change the last part of ...

4 días ago | 0

| accepted

Plotting a vector field
In slice command, you need to specify the locations on x, y and z axis at which you want to plot the plane. For example M; % 44...

4 días ago | 0

| accepted

create multiple separate vectors from a For loop
You current approach is optimal. Creating seperate variables like dice1, dice2, .. is not a good coding approach: https://www.ma...

4 días ago | 0

Call values from the struct file
You can access it like this [~,idx] = max([props.Area]); props(idx).BoundingBox(4)

4 días ago | 0

| accepted

How to use filloutliers for only positive numbers of a data array?
Try this a = [ 2 1 23 -1 2 5 -36 6 -1] a(a>0) = filloutliers(a(a>0),'Linear')

4 días ago | 0

| accepted

Changing order of legend entries
You can change the order, but for that you need the handle for each line. For example, plot two lines p1 = plot(rand(1,10)); p...

4 días ago | 0

Initialize MATLAB-Function
This is not really an error. It just tells that you need to change the sampling rate of this block from continuous to discrete. ...

5 días ago | 0

| accepted

matrices A, B, and C.

5 días ago | 1

fminsearch with matrices help
x and y should be 3x150 to match the dimensions of matrix A. Following shows the correct code with fminsearch x = rand(3, 150);...

5 días ago | 0

how can I groups binary digits in array element
Try this combination of sprintf and sscanf. A = [11 1 1 1 1 1 1 1 0 1 0 1 0 1 0]; B = sscanf(sprintf('%d', A), '%4d'); Result...

5 días ago | 0

| accepted

How to define recursively symbolic function for differential equation system
This depends on what your ODE is. For example consider this ode each different value of 'a' create a different ODE. Now consi...

5 días ago | 0

How to set randomization numbers ?
You can give a constant seed at beginning of your code rng(0); % replace 0 with anything A=randn(1,2); B=randn(1,3);

5 días ago | 0

| accepted

Add Variables to workspace from a struct
It is not a good coding practice to create a variable name like S1, S2, ... https://www.mathworks.com/matlabcentral/answers/3045...

5 días ago | 0

| accepted

Indexing animated lines from array
When you initialize an array of MATLAB graphics objects like this num_plots = 2; g(1:num_plots) = animatedline; MATLAB create...

5 días ago | 0

| accepted

How do I create a for loop for averages?
No need to use for-loop averages = mean(RCP26(:,2:13), 2) See the dim argument to mean() function: https://www.mathworks.com/h...

6 días ago | 1

| accepted

From XY array data in pixels to BW image
A little mistake in the calculation of idx idx = sub2ind([20 20],A(:,2),A(:,1)); % Last input shoule be A(:,1) Rest is correc...

6 días ago | 1

| accepted

How do I select a window of pixels around a pixel?
See conv2(): https://www.mathworks.com/help/matlab/ref/conv2.html or imfilter(): https://www.mathworks.com/help/images/ref/imfi...

6 días ago | 0

how to count the number of a specific value in a cell array and how to access the index of each value
If possible, use numeric array for this type of data. They will be much more efficient and easy to deal with. For cell array, yo...

6 días ago | 0

Solve as Optimization Problem in Matlab
MATLAB have genetic algorithm ga() from the global optimization toolbox to solve such problems f = @(x) 121 - 15*x(1) - 16*x(2)...

6 días ago | 1

| accepted

Difference between fprintf(fid, [str, 13 10]) and fprintf(fid, [str, '\n']) ?
ASCII 13 is carriage return character. It can be combined with newline (ASCII 10) to move to beginning of next line. Following l...

6 días ago | 1

| accepted

Heatmap title - Interpreter (AppDesigner)
It still does not support Interpreter. The workaround is to escape the underscore character h1.Title = strrep(file, '_', '\_')

6 días ago | 0

| accepted

Size input must be scalar using rand to generate uniformly distributed numbers
rand() does not accept the range of random values. It always generates values between 0 and 1. You need to rescale yourself. lb...

6 días ago | 0

| accepted

Negative Numbers to the power of 0
You can do it without for-loop k = 0:4; x = [-2.0 3.0 9.0 2.0 25.0]; A = x.^(k.') Also, x(col)^k(row) is equivalent to (-2...

6 días ago | 0

| accepted

Unknown Parameter in Transfer Function
You can write the time-domain equation of this transfer function and then implement it using elementary blocks. Then you can var...

6 días ago | 1

Can my pc run Matlab
Your system meets the minimum requirements: https://www.mathworks.com/support/requirements/matlab-system-requirements.html so it...

6 días ago | 1

Cluster pixels in Binary Image from 2D-Histogram Data
You can use regionprops(): https://www.mathworks.com/help/images/ref/regionprops.html to get each white region in your image. Th...

6 días ago | 0

How can I solve a problem related to the output argument.
The name of output argument does not matte outside the function. If you just want to output two values for each case, just use ...

6 días ago | 0

| accepted