Answered
How to separate cell rows in different cell??
Do you mean like this? A = yourcell(1,:); B = yourcell(2,:); : etc But if you have lots of rows to deal with...

8 years ago | 0

| accepted

Answered
Round down lowest number in a decimal number
E.g., x = whatever result = floor(x*100)/100;

8 years ago | 1

| accepted

Answered
Copying dynamic array to MxArray object using memcpy in c++
Two fundamental problems: 1) You can't guarantee that successive calls to calloc( ) will produce memory segments that are adj...

8 years ago | 0

| accepted

Answered
How can I find roots of cubic function?
Do you mean like this? syms x y solve('y^3 - (x+50)*y^2 +(500*x -5200)*y + (3600*x) = 0',y)

8 years ago | 0

Answered
Fibonacci sequence function problem
The fibonacci( ) function was introduced in R2017a. What version of MATLAB are you running? If you are running an earlier ver...

8 years ago | 1

Answered
Error in fzero function
Use a function handle. E.g., fzero(@(x)x^3+2*a-b,-1)

8 years ago | 0

| accepted

Answered
Hi everyone! I need help!
Maybe adding another sum gets the result you want? y(j,i,k) = sum(sum(Mat (:,:,[k]) == Mat(j,i,k)));

8 years ago | 0

Answered
Bubble sort that stops running when sorted
Typically you have a variable that keeps track of whether you did a swap or not in your most recent loop. E.g., did_a_swa...

8 years ago | 0

| accepted

Answered
What happen with my code????, please help me fix this!!
See if this link helps you understand what is going on with your floating point calculations: <http://matlab.wikia.com/wiki/F...

8 years ago | 0

Answered
Create a matrix with letters
Is this what you want: A = [sym('m%d',[n 1]) sym('x%d',[n 1]) sym('y%d',[n 1]) sym('z%d',[n 1])]

8 years ago | 0

Answered
Converting Hexadecimal values to Ascii Text
E.g., using the char( ) function: >> h = '41' h = 41 >> d = hex2dec(h) d = 65 >> c = char(d) c = ...

8 years ago | 1

Answered
problem while applying bisection method "Undefined function or variable 'vbr'
vbr needs to either be a function file (i.e., a file named vbr.m on your MATLAB path), or more likely you should pass that into ...

8 years ago | 0

Answered
Reshaping/vectorizing a n-d matrix to a vector along each dimension
result = reshape(permute(a,[3 2 1]),[],1);

8 years ago | 0

| accepted

Answered
Generating samples of two dimensional random variable
Y = something Z = something result = rand(Y,2*Z); result(:,2:2:end) = result(:,2:2:end) .* result(:,1:2:end);

8 years ago | 0

| accepted

Answered
Create a matrix with a repetitive pattern
x = your original vector n = number of vertical repititions result = repmat(x,n,1);

8 years ago | 0

| accepted

Answered
Fast computation of 2D summation
T = reshape(B,size(B,1),[]) * A(:);

8 years ago | 0

| accepted

Answered
Getting the nonzero mean of each cell element
Can you do this: mean_value = cellfun(@(x)mean(nonzeros(x)),dot_value);

8 years ago | 0

| accepted

Answered
how to reshape a matrix using for loop
Try switching the m and n in your for-loop indexing, and use (i,j) for your indexed assignment instead of (m,n). E.g., for ...

8 years ago | 0

Answered
How do I create an array of answers for the given program? it gives me an error of "Assignment has more non-singleton rhs dimensions than non-singleton subscripts." How can I fix this?
MU is a vector, so the right hand side is a vector. You can't stuff that into a single scalar spot c(i,j).

8 years ago | 0

Answered
Delete a row from matrix and save the modified matrix as a new matrix?
Ym = Xm; % create a new matrix Ym(3,:) = []; % modify only the new matrix

8 years ago | 1

| accepted

Answered
How can I include the derivative of a function as an input to a function handle?
Currently you have a 3-element state vector, with the states being a, b, c. You simply use a 4-element state vector with the 4th...

8 years ago | 0

Answered
How do I use input to make a string and fprintf to output different parts of the string?
Use the 's' option to read the input as a string. E.g., name=input('enter your name ','s'); Then you can use fprintf wit...

8 years ago | 1

| accepted

Answered
FFT implementation by myselft
Use 1/40 instead of 1/20, and modify your inverse formula to account for the -1 difference between the MATLAB indexing (1-based)...

8 years ago | 0

Answered
How many years are needed to have the INTEREST accumulated above $30,000 USD?
OK. Since you are specifically instructed to use a loop for this, you could start with this rough outline: % Put the initia...

8 years ago | 1

| accepted

Answered
Creating a matrix with [xb^2, xb, 1]
A = [xb(:).^2 xb(:) ones(numel(xb),1)];

8 years ago | 1

| accepted

Answered
How to create six different matriceses, by changing one value in six different intry's of an existing matrix, using a loop.
x is double class, so you don't use curly braces with that. E.g., x(koor1{i},koor2{i}) = 19; Not sure what the purpose o...

8 years ago | 0

| accepted

Answered
Output argument "variable" (and maybe others) not assigned during call to "function".
Your code is calling a function named "u" and that function is not returning a value, so nothing gets assigned to val. What does...

8 years ago | 0

| accepted

Answered
I have two matrices that are related and I need to sort one matrix while sorting the corresponding matrix the same way.
E.g., >> A = [3, 5, 2, 7, 8; 2, 3, 7, 3, 4; 7, 3, 2, 6, 2]; >> B = [1, 0, 1, 1, 0; 1, 1...

8 years ago | 0

| accepted

Answered
Is it possible to utilise ODE45 in a for loop with indices?
To my reading of the problem, your state vector is a single z vector with indexing 1,...N. Is this correct? So if we start w...

8 years ago | 1

| accepted

Answered
Bisection Method - Multiple roots
You need to provide different starting positions that bracket only one root at a time. In general you can't guarantee which root...

8 years ago | 0

Load more