Answered
Can anyone help me to find the mistake in this code?
Why the switch from W to V? Seems to me you should be using W all the way through. E.g., W = W(I); Z1 = W1(I).*sqrt(-2....

11 years ago | 0

| accepted

Answered
I have arrays and I want to put them in a table
Does this do what you want: mytable = table(Station_1,Station_2,Station_3,Station_4,Station_5,'RowNames',{'Pressure','Temp'...

11 years ago | 0

Answered
How to compare class type of 2 variables to find equality and use it within switch-case
What if you simply switched on the value of c? E.g., switch c Does this do what you want? Or is there something else y...

11 years ago | 0

Answered
Matrix dimensions don't agree
Try changing the division to element-wise: pred = (((K-b)*(age.^2))./((a^2)+(age.^2)))+b; % <-- Changed / to ./

11 years ago | 0

| accepted

Answered
Is it possible to make alias for a variable?
The closest thing in MATLAB to this might be a classdef object derived from handle, where multiple variables actually "point" to...

11 years ago | 0

Answered
Wrapping a MEX function that has an "ans" output in some cases
I am not on a machine with MATLAB at the moment to verify this, but I think the syntax for passing variable number of arguments ...

11 years ago | 2

| accepted

Answered
Finding rows with the closest values in two matrices matlab
E.g., not sure if this is what you want but to make B look like the order in A, keying off of the 2nd column and keeping the row...

11 years ago | 0

Answered
quat2angle function
If you run the code below, you can confirm the following with respect to the functions in the Aerospace Toolbox: The rotation...

11 years ago | 0

Answered
Relative motion between Quaternions
In general, for unit quaternions you would multiply the conjugate of one times the other, and then extract the angle and rotatio...

11 years ago | 3

Answered
Convert 8 Byte timestamp to a human readable time!
I haven't gone through your one-liner in any detail, but if you are starting with the 8 bytes shown above, then a simple typecas...

11 years ago | 0

| accepted

Answered
Decoding DNA sequence into binary
One way: s = 'TGACTCAGTCGTTCAATCTATGCC'; % Input DNA string [~,x] = ismember(s,'ATGC'); % Convert the ATGC into indexe...

11 years ago | 0

| accepted

Answered
How do i do a for loop within a for loop with a variable changing n=1:42.
Why can't you use simple if-tests on the value of n to set the value of I?

11 years ago | 0

Answered
How can you get totals from separate cell arrays?
Use cell2mat to convert them to doubles, then add them up.

11 years ago | 0

| accepted

Answered
Help with Alogrithm????
You could save the x and y result from each iteration in a vector, but rather that do that you don't really need the for loop at...

11 years ago | 0

| accepted

Answered
If I have a 4x4 cell array, 'm' where each element is a matrix expressed as '4x4 double', what would be the notation to access the values of a matrix within 'm'.
For a cell array m, m(i,j) is the i'th row, j'th column element of m. m(i,j) is a 1x1 cell array. m{i,j} is the ...

11 years ago | 1

| accepted

Answered
how to save array values in .mat file in 1 column and multiple rows instead of multiple columns in 1 row.
Transpose j before saving it. E.g., j = j.'; % <-- transpose j save('j.mat', 'j');

11 years ago | 0

| accepted

Answered
Adding the elements to next element
result = cumsum([initial_A A]);

11 years ago | 0

| accepted

Answered
Why does char give me an empty output?
Characters for ASCII codes 1, 2, 3, 4, 5 are all unprintable characters, so nothing prints. The conversion *did* take place, but...

11 years ago | 2

| accepted

Answered
Issue with random function
What is the class of the variable random? Is it a double at the command line but something else in your script?

11 years ago | 0

Answered
random number from a set of define numbers
Try this: HOT = [3,11,29,30,33,35]; OTHER = 1:37: OTHER(HOT) = []; x = randperm(6,3); y = randperm(31,3); pi...

11 years ago | 0

| accepted

Answered
Why won't my code run? Matlab just says its busy when i run it?
The f(0) looks like a typo in this line: if sign(f(a)) * sign(f(0)) < 0 As for the rest of the code, nobody is going to ...

11 years ago | 0

Answered
While Loop is not ending, just keeps repeating from top
Some slight changes: colour = {'Red','Green','Blue'} x=colour{randi(numel(colour))}; % <-- Added semi-colon so you don't...

11 years ago | 0

| accepted

Answered
How can I find the maximum deviation between two matrices?
Maybe this? max(abs(A(:)-B(:)))

11 years ago | 0

Answered
Choosing one answer from 3 in Solve
To get the real part of the 3rd element, e.g., >> x = [-1.35-4.59i , -0.136-4.59i , 1.18+9.18e-41i] x = -1.3500 - 4...

11 years ago | 0

| accepted

Answered
counting number of inputs
Use a variable as a counter. E.g., suppose the variable name was guesses. Start with guesses=0 and then do guesses=guesses+1 fo...

11 years ago | 0

Answered
How to delete a submatrix from a matrix using the ZEROS command instead of [ ] square brackets?
Using explicit brackets [ ] on the right hand side of an equation combined with using indexing on the left hand side variable is...

11 years ago | 0

Answered
how to get the value a number at a specify decimal position ?
Use sprintf, find the decimal point, then get the desired digit after the decimal point. That being said, realize that for some...

11 years ago | 0

| accepted

Answered
How to aggregate two columns
This is how one would do it if A and B are doubles: C = A*1e8 + B; However, each of A and B has 8 decimal digits, so the...

11 years ago | 0

Answered
Are there any function to check a string in the argument list?
any(cellfun(@isequal,varargin,repmat({'off'},size(varargin))))

11 years ago | 0

| accepted

Answered
out of memory because of large matrixs and vectors
Please show the code you are using to create these vectors and matrices. Are you sure you are not inadvertently attempting to cr...

11 years ago | 0

Load more