Answered
Does Matlab initialize random seed at each -batch run?
Yes, exactly as you observe the random number generator is initialized with the same seed. Use rng to get different seeds. See:...

10 días ago | 0

Answered
How to maximize the graph area in case of subplots ?
There is a bunch of solution in the FileExchange. Search for "subplot": https://www.mathworks.com/matlabcentral/fileexchange?q=...

10 días ago | 0

Answered
Equivalent of numpy.where() value choice parameters
Your code looks almost fine: x = 0:9 y = (0:9) * -0.1 z = zeros(size(x)); z(mod(x, 2) == 0) = x(mod(x,2) == 0); % ...

12 días ago | 0

| accepted

Answered
Understanding coding terminology - indexing
"Indexing" means to address an element of an array by using an index. Example: x = [3,1,4] index = 2 x(index) % reply: 1 T...

12 días ago | 0

Answered
calculation norm divided by square root of data length
r = [-33.1869365513747 - 7.19942077700726i 9.95754431609273 - 9.07572996519880i 5.11935460162031 - 9.45713125754552i 17.24067494...

12 días ago | 0

| accepted

Answered
How to filter out the elevation higher than 0
I do not see, where your filter out elevations greator 0. It is faster to call interp2 with vectors as coordinates. So avoid ca...

12 días ago | 0

| accepted

Answered
Alternatives for dir command
addpath \\winfs\data\prod\maprod\arkivering\TAF; Why do you append this folder to Matlab's path? Are the files stored in this f...

12 días ago | 0

| accepted

Answered
Multiplication between elements of two different cells
"first 36 row of F will be multiplied by the first row of T and next 36 row of F will be multiplied by second row of T and conti...

13 días ago | 0

| accepted

Answered
How to solve error "merge_sort: failed to get memory buffer"
This sounds like your memory is exhausted. Are you running out of RAM?

13 días ago | 0

| accepted

Answered
Dynamically change .txt file name in MATLAB, COMSOL simulation
fname = sprintf('Results_E_Field_Iter%d.csv', iter); file = fullfile('/Users/marissawhitby/Desktop/C:\Users\jmw\Desktop\Output...

15 días ago | 1

| accepted

Answered
repeat vector elements and operate on them
Start with a simple loop: A = [12; 10; 5]; B = [4; 3; 2]; RepSum(A, B) function C = RepSum(A, B) len = sum(B); C = zer...

16 días ago | 2

Answered
Will this computer run Matlab?
Yes, of course. This is a powerful computer. It depends, on what you want to compute. If a model does not match into the RAM, m...

16 días ago | 0

| accepted

Answered
Publishing an mfile including the calls to other m files.
Does this help: https://www.mathworks.com/matlabcentral/fileexchange/33476-publish-dependent-and-called-functions ?

16 días ago | 0

Answered
I can`t solwe gauss elimination method
I've simplified the code and converted it from Octave to Matlab: A = [ -3 6 -1 -2; -3 3 -3 1; -1.5 4.5 -2.5 -0.5; 0 1.5 -0.5 -3...

16 días ago | 0

| accepted

Answered
Arrays have incompatible sizes for this operation.
Use the debugger to identify the problem. Type this in the command window: dbstop if error and run the code again. When Matlab...

16 días ago | 0

| accepted

Answered
How its possible do define this function in Matlab?
Your funcion is almost correct. Just change && to & and consider the logical index time in the output. The problem in your case...

16 días ago | 1

| accepted

Submitted


NoverK
Fast and accurate N over K

19 días ago | 2 downloads |

Answered
Automatically Run Script at End of Toolbox Installation
I include a function, which runs once the first time the toolbox is called instead. This is "after the installation", but not di...

19 días ago | 1

| accepted

Answered
when i was plotting i reveived this error, please help me out....
For me it works: fun = @(x) exp(-x) - 3.*x.^2 + 26 fplot(fun,[0 5]) grid on So if this fails for you, you are running anothe...

19 días ago | 1

Answered
How can I vectorize the nested loops in my code to improve performance?
The editor shows you 12 valuable hints already: Letting an array grow iteratively is very expensive. See this example: x = []; ...

20 días ago | 2

| accepted

Answered
how to solve this MATLAB solve error?
This looks suspicious: "datatype = integer[1]" ?! Maybe there is some preceeding code, which causes problems? At least the show...

20 días ago | 0

| accepted

Answered
How to get an array of all field elements of a 1xN structure with many fields
Fields = fieldnames(S); for ii= 1:numel(Fields); field = Fields{ii}; [S(:).(field)] end [...] is the horizontal con...

20 días ago | 1

Answered
Time-varying coefficient in ODE.
Which ODE solver do you use? Remember that Matlab's builtin ODE solvers like ODE45 ar designed for smooth functions only. A para...

20 días ago | 0

Answered
Extracting data from a figure
The error message looks like you are opening a .fig file but you do not have the required SizeChangeFcn. Then you can redefine t...

21 días ago | 0

Answered
Error using fzero (line 184) FUN must be a function, a valid character vector expression, or an inline function object. What is the issue here?
v is the variable of the function. You do not have to deine it as a vector. fzero expects a function handle, but f(vi) is a num...

21 días ago | 0

Answered
A Matlab Code is "Attempt to execute SCRIPT ballTrajectoryFun as a function:"
The file ballTrajectoryFun.m is a script, not a function. Functions start with the keyword "function". If they are called from O...

21 días ago | 1

Answered
How do i add a for loop if command to a pre existing table
shop1 = [4,5,3,6,0,5,5,6,4,5]; shop2 = [5,3,1,1,3,5,3,6,3,3]; profit1 = 3 * shop1; profit2 = 4 * shop2; pool = {'Sh...

21 días ago | 0

| accepted

Answered
divide a vector into two vectors of unequal length
A = [1 2 3 4 5 6]; idx = ceil(numel(A) * 2 / 3); B = A(1:idx) C = A(idx + 1:end)

21 días ago | 2

| accepted

Answered
Error: array indices must be positive integers
You can use the debugger to find the cause of the problem. Let Matlab stop when the error occurs: dbstop if error Type this in...

22 días ago | 0

| accepted

Answered
I need to make a function that solves the first derivative of a function using forward finite difference. I've tried creating the function but I encountered an error.
You provide the CHAR vector 'q3func' as input, but you want a handle to the function instead: fd = forwarddiff(@q3func, -2:2, 0...

22 días ago | 0

| accepted

Load more