Answered
Undefined function or variable 'ran' in matlab R2018a
The function name is rand(): https://www.mathworks.com/help/matlab/ref/rand.html, not ran().

5 years ago | 0

Answered
SUM of selected elements in Matrix
Are you looking for something like this M = [1 1 2 60; 2 3 2 90; 3 1 3 240; 4 2 3 200; 5 3 3...

5 years ago | 0

| accepted

Answered
I can't get millisecond accuracy from string based timestamp - not sure what I'm doing wrong
Also set the format property to display them in the format you want formatted_timestamps = datetime(raw_timestamps, 'InputForma...

5 years ago | 0

| accepted

Answered
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 ...

5 years ago | 1

Answered
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 ...

5 years ago | 0

| accepted

Answered
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...

5 years ago | 0

| accepted

Answered
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...

5 years ago | 0

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

5 years ago | 0

| accepted

Answered
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')

5 years ago | 0

| accepted

Answered
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...

5 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
matrices A, B, and C.
Since this is a homework problem, I won't give answers. Following links will be helpful https://www.mathworks.com/company/newsl...

5 years ago | 1

Answered
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 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

| accepted

Answered
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 years ago | 0

| accepted

Answered
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...

5 years ago | 1

| accepted

Answered
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...

5 years ago | 1

| accepted

Answered
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...

5 years ago | 0

Answered
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...

5 years ago | 0

| accepted

Answered
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)...

5 years ago | 1

| accepted

Answered
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...

5 years ago | 1

| accepted

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

5 years ago | 1

| accepted

Answered
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...

5 years ago | 0

| accepted

Answered
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...

5 years ago | 0

| accepted

Answered
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...

5 years ago | 1

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

5 years ago | 1

Load more