Answered
Dynamic allocation of mxArray structure
_"... The memory should be allocated by chunks, so that in case of insufficient memory the calculation can be stopped and the re...

9 years ago | 0

Answered
Find all numeric values right after the NaN values in a column vector
E.g., x = find(isnan(vec))+1; x = x(x<=numel(vec)); % or x(x>numel(vec)) = []; result = vec(x);

9 years ago | 0

Answered
Using ode45 to solve an interest rate problem regarding an ODE.
Look at the very first example here in the doc: https://www.mathworks.com/help/matlab/ref/ode45.html?searchHighlight=ode45&s_...

9 years ago | 0

| accepted

Answered
i am geeting a wrong answer for this calculation mod(10^27,55)
E.g., simple loop: r = 1; for k=1:27 r = mod(10*r,55); end r r = 10

9 years ago | 1

| accepted

Answered
I have a request set of size [ 1 2 3 4 5 6 7 8 9 10] these request demand some bit rate of size [6 5 6 4 7 3 5 5 4 7] .I want to sort these request according to request that demand most bit rate.
Use the 2nd output of the sort function to get the desired indexing, then feed that back into the vector you want sorted in that...

9 years ago | 0

Answered
obtaining an array containing arrays
E.g., m = number of loop iterations B = zeros(m,4); for k=1:m A = results of current iteration B(k,:) =...

9 years ago | 2

| accepted

Answered
Index Exceeds Matrix Dimensions
You can use the debugger for this. First, type in the following at the command line: dbstop if error Then run your code...

9 years ago | 0

Answered
Function handle doesn't work as intended
Just quickly looking though what was posted, this line: grid onq_tot2 = @(deltaT) integral(@(r) stopp(r), r_c, r_max) lo...

9 years ago | 0

Answered
what does A(3, :) mean or A(:, 3)?
If A is a 2D matrix, then A(3,:) is the 3rd row of A A(:,3) is the 3rd column of A If A is a multi-dimensional array, t...

9 years ago | 5

| accepted

Answered
Calling from Matlab a recusive function written in C
In addition to what Geoff has already written, in your "code without output parameter" you are not setting the value of the retu...

9 years ago | 1

| accepted

Answered
Combining hours and minutes
If you just want to combine them into a string with the HH:MM format, e.g., out = sprintf('%02d:%02d',file(8,1),file(9,1));...

9 years ago | 0

| accepted

Answered
How to Modify Entries in Cell
result = cellfun(@(x)x(:,:,1:end-2),your_cell_array,'uni',false);

9 years ago | 1

| accepted

Answered
how to calculate algorithm speed?
I would start with tic and toc. You could also use timeit.

9 years ago | 0

| accepted

Answered
Error using element-wise multiplication
Remember, the syntax A([end 1],:) is only 2 rows, not the entire matrix. That is why you are getting the error. To do what you...

9 years ago | 0

| accepted

Answered
Retrieving the original LSBs in LSB steganography
If you overwrite the original data with something else, and you have nothing else in the image that can be used to reconstruct t...

9 years ago | 0

| accepted

Answered
How to use ode45 to solve a system with many dimensions?
If I understand your equations correctly, simply dx = x .* (alpha - a*x);

9 years ago | 0

| accepted

Answered
overlapping time steps in ODE45
Please show the code for 'center1'. Why can't you modify this code to simply use the t input to determine which value of Fy to ...

9 years ago | 0

Answered
Matlab Error using .*. Matrix dimensions must agree
k is a vector and tp is a vector. They are not the same size. So you need to revisit this calculation to see what you really w...

9 years ago | 0

Answered
calling fortran subroutine from matlab: keep getting errors
For Fortran mex routines, one should always use the exact subroutine signatures that are listed in the doc to make sure there is...

9 years ago | 0

Answered
I want to divide one vector to two vectors that complement each other .. How can I obtain all possible combinations of these 2 vectors ?
You could use the FEX submission ALLCOMB by Jos for this. E.g., x = your original vector of non-negative integers c = c...

9 years ago | 1

| accepted

Answered
Graphing Maclaurin sinx and getting horizontal line at zero
To start with, use element-wise operators for the / and * operations also. E.g., e = (z.^n)./factorial(2*n+1).*(x.^(2*n+1)...

9 years ago | 0

Answered
How can i add the C source code of a matlab function to a mexfunction of a matlab toolbox written withc/c++ code ?
If I understand your question correctly, you want to modify existing compiled code by adding your own code, but you don't have t...

9 years ago | 0

| accepted

Answered
How to normalize data between 0 and -1.4?
E.g., using simple linear scaling based on the range of the current data: data = your matrix actual_min = min(data(:)); ...

9 years ago | 0

Answered
create a matrix from a for loop and store it or allot it one after the other from a for loop
You could save each piece in a cell array: Kb = cell(4,4); : Kb{i,j} = [ 0 0 0 : Then a...

9 years ago | 0

Answered
how to loop over the structure fields and get the type of data ?!
You could loop over the fieldnames, e.g. fn = fieldnames(mystruct); for k=1:numel(fn) if( isnumeric(mystruct.(fn{...

9 years ago | 47

| accepted

Answered
Logical indexing of matrix doesn't output matrix of the correct dimensions
Is this what you want? I just added the colon : to select all of the columns. window = userData(windowLogical,:); (In g...

9 years ago | 0

| accepted

Answered
how do I turn the columns and rows in a random matrix?
result = flipud(fliplr(your_matrix)); or result = reshape(your_matrix(end:-1:1),size(your_matrix)); or result ...

9 years ago | 1

| accepted

Answered
Double precision in mex file
_Can the mex file reduce somehow precision of a variables?_ No. Double precision in a mex routine is the same as double preci...

9 years ago | 0

| accepted

Answered
After Mex compilation fails, Matlab crashes and doesn't open again
Lp=mxCreateNumericArray(1, &N1, mxDOUBLE_CLASS, mxREAL); : for (i=0;i<N1;i++) { : ((dou...

9 years ago | 0

Load more