Answered
Array Building using Dynamic Field Reference using an Array of Strings
>> Data.Field1 = [1;2;3] Data = Field1: [3x1 double] >> Data.Field2 = [4;5;6] Data = Field1: [3x1 dou...

11 years ago | 0

Answered
Returning the final value of a while loop
Just set your return variable to x. E.g., function P = myFunction(x,y,h) while (x-y) > h x=x-1; end P = x;...

11 years ago | 0

| accepted

Answered
num2str weird behavior with decimal input....
FYI, here are the exact decimal conversions of the IEEE double floating point bit patterns in question: >> num2strexact([.0...

11 years ago | 0

Answered
Finding the approximate length with for loop?
Taking the instructions verbatim: dividing [a, b] into n equal subintervals determining the location of the object at ea...

11 years ago | 0

| accepted

Question


Preserving Versions of Questions
Lately there has been a rash of people asking Questions, only to delete the original question (replacing it with meaningless tex...

11 years ago | 0 answers | 3

0

answers

Answered
how to declare all the rows and all column in matlab in a matrix or array??
c(:) is the syntax for the entire matrix, not a particular row. And when used on the rhs of a statement it means "reshape c as a...

11 years ago | 0

Answered
Fibonacci Using While Loop
You don't assign your iterative result to the fibonacci array. E.g.: fibonacci(i) = fibonacci(i-1) + fibonacci(i-2); H...

11 years ago | 0

| accepted

Answered
In place array flipping - mex in place
Unless TMW officially documents this, I think you are stuck with your explicit loop approach. If TMW documents the in-place rule...

11 years ago | 2

Answered
MATLAB :How to program with MATLAB
You should probably review the basics of MATLAB. E.g., http://www.mathworks.com/help/matlab/getting-started-with-matlab.html ...

11 years ago | 1

Answered
Adding FFmpeg toolbox into MATLAB
Not familiar with ffmpeg, but maybe try the function call syntax (I assume file.mp3 is a typo and you meant MP3file?): ffmp...

11 years ago | 0

Answered
Code Continuously Runs - Newton Raphson
I haven't looked at your algorithm in detail, but just the convergence code seems suspicious to me: %Find new value of dy...

11 years ago | 0

Answered
Simplifying the If statements.
cabs_vector = [9 10 11 12 9 10 11 12 13 14 15 16 13 14 15 16]; idcabs = cabs_vector(idabs);

11 years ago | 0

| accepted

Answered
How can I select a default folder?
Create a file called startup.m in the folder that MATLAB starts in and add anything you want in it for startup commands. E.g., a...

11 years ago | 0

| accepted

Answered
Comparing cell arrays of strings of unequal size/replacing missing values with zeroes
A = {'dog','cat'}; B = {'dog','cat','fish','horse'}; B(~ismember(B,A)) = {0} B = 'dog' 'cat' [0] [0]...

11 years ago | 0

| accepted

Answered
solving a sequence in matlab
Plugging everything in I get A^5 * x = b So the solution would be x = A^5 \ b However, your expressions for...

11 years ago | 0

| accepted

Answered
Need NaNs in data but not to be evaluated and keep then put back
Keep track of the isnan locations, and use that to put the results in the proper element locations. E.g., assuming Group_1 is th...

11 years ago | 0

Answered
Warning: Matrix is singular to working precision.
Z=(sin(sqrt(X.^2+Y.^2)))./(sqrt(X.^2+Y.^2)); % changed / to ./ The ./ is element-wise division, whereas the / implies t...

11 years ago | 1

| accepted

Answered
Is it possible to solve a pair of two equations for four unknowns
A brute force method to get a single solution: % Equations (pick x and y both not 0 and not too big) disp('Numbers') ...

11 years ago | 0

Answered
How to work around memory errors?
I guess the obvious suggestion is don't use repmat, but rewrite the sum((pb-boundred).^2) calculation as a loop instead. What ar...

11 years ago | 2

| accepted

Answered
Read double precision numbers from binary file
Did you mean to type the following: cAddress = (char*)(&value); // Added the & for type punning Otherwise, the method of...

11 years ago | 1

| accepted

Answered
Why can't I store this many values In line
Since v7 is an integer type (int16), when you combine it with doubles in concatenation [ ], the doubles get converted to int16. ...

11 years ago | 0

| accepted

Answered
How to find undefined matrix in a code?
If the variable is not defined at all, you can use this: if( exist('variable_name','var') ) % variable_name is defin...

11 years ago | 1

| accepted

Answered
create a vector ,of sets of predefined numbers stored in another row vectors
Not sure how you want the answer actually stored (the syntax in your example isn't clear), but here is one way: XX = repmat...

11 years ago | 0

Answered
How do I reverse the order of two rows of a 4x4 matrix using a for loop?
Did you mean this? A(3,:)=fliplr(A(3,:)); % replaced 1 with a 3 If not, can you describe your problem in more detail...

11 years ago | 0

Answered
How to work out the length of a line
% x = your x coordinate vector % y = your y coordinate vector % d = diff([x(:) y(:)]); d = diff(your 3D point ma...

11 years ago | 2

| accepted

Answered
How to concatenate two matrices in a loop?
Another way using 3-dimensional syntax: n = number of individual matrices you have; R = number of rows per matrix; C ...

11 years ago | 1

| accepted

Answered
generating 10 samples from a binomial using a fair dice.
First, to fix your code I am guessing you are getting error messages about Xx and UR as functions or variables. To concatenate v...

11 years ago | 1

| accepted

Answered
hi, i am using this code.....alfa = inv([r00 r11 r10 r12; r11 r00 r01 r01;... r10 r01 r00 r02; r12 r01 r02 r00])*[r01 r10 r11 r11]; in which i am getting the error"Error using * Inner matrix dimensions must agree"
Assuming all of your rxx variables are scalars: This is a 4x4 matrix: [r00 r11 r10 r12; r11 r00 r01 r01;... % 1st and 2n...

11 years ago | 0

Answered
How to make an angle continuous from -inf to +inf
doc unwrap >> p = (pi/180)*[-177 -178 -179 -180 179 178 177] p = -3.0892 -3.1067 -3.1241 -3.1416 3.1241 ...

11 years ago | 1

| accepted

Load more