Answered
Data type Conversion problem
This is just a display issue. The accuracy is still there in the background. E.g., >> format short % display only first 4 ...

11 years ago | 0

Answered
How to plot polynomial equation numerically?
Using your latest equation I don't see any obvious simplifications. So maybe just multiply the whole thing by x^4 (to give you a...

11 years ago | 0

Answered
Baseball simulator question help
For the outcome of a single at-bat, there are various ways to do it. Suppose the 9x5 matrix is called "probabilities". Then the ...

11 years ago | 1

Answered
Question answered, thanks: question on line break using fprintf
Include the newline \n at the end of the text where you want the line break. E.g., fprintf("This is the first line\n"); ...

11 years ago | 0

Answered
Matlab loops help (with physics)
OK, now we have something to work with. Thanks for making the coding attempt and posting it. My suggestion is to first simpli...

11 years ago | 0

Answered
Load MAT files and Then Save new MAT file with same Name after calculations
E.g., see this link http://www.mathworks.com/matlabcentral/answers/57446-faq-how-can-i-process-a-sequence-of-files

11 years ago | 0

Answered
Compiling C and Fortran source files in a single call to MEX.
Compile the source code without the mexFunction first using the -c option (compile only). That will produce an object file. Then...

11 years ago | 0

Answered
How to get my code to define variables
I assume you mean you want to capture the variables Delta, theta, etc in the workspace where mindeviation is called. You must do...

11 years ago | 0

Answered
Matlab coder and exponentiation
Have you tried A = exp( C * log(B) ) ?

11 years ago | 0

Answered
return to a previous statement
while( true ) a = value1; b = value2; % analysis if( condition ) % code break ...

11 years ago | 5

| accepted

Answered
how can i solve this 'Inner matrix dimensions must agree.' error?
Put global statement in your functions that set a and b so their values get back to your plotting function. function slid...

11 years ago | 0

| accepted

Answered
How to read LSB of audio sample?
Here is an example of overwriting the least significant byte of a double with other bit patterns, in this case the string 'hidde...

11 years ago | 1

| accepted

Answered
Multiplying along the 3rd dimension of a 3D matrix
If you mean element-wise multiply, then: prod(your_matrix,3)

11 years ago | 0

Answered
question concerning rounding of numbers
See also this link: http://www.mathworks.com/matlabcentral/answers/185019-matlab-round-function-not-rounding-small-decimals-a...

11 years ago | 2

| accepted

Answered
Does using dis(variable) command display the contents of the variable without displaying the variables name?
No. It displays an error message. Undefined function 'dis' for input arguments of type 'double'.

11 years ago | 0

Answered
1) Given the following MATLAB for loop: for a= 1:6 b=a*3; end What is the value of b upon completion of the loop?
- Highlight all three lines of the for loop - Press Ctrl-C - Click on the MATLAB command window (the one with the >> sho...

11 years ago | 1

Answered
Combining the matrix' values
C = allcomb(A(1,:),A(:,2),A(:,3))' You can find allcomb (by Jos) on the FEX: http://www.mathworks.com/matlabcentral/file...

11 years ago | 0

| accepted

Answered
Problem appending a variable to an existing text file using save
You still need to tell MATLAB that it is an ASCII text file you are writing to and not a mat file. E.g., save(tempname1, 's...

11 years ago | 1

| accepted

Answered
How can I derive solution in matrix form?
Use the dot versions of the operators to get element-wise operations. E.g., eqn=x.^2.*y.^4+~~~~~~ % <-- Note the use of .*...

11 years ago | 0

Answered
how to select a randomly from the matrices?
To select a random row from a matrix: the_matrix = your matrix the_random_row = the_matrix(randi(size(the_matrix,1)),:);...

11 years ago | 2

Answered
How to compact an array with repeated data and NaNs?
Brute force using loops (if there are different non-NaN values available for a particular spot, picks the max of them): [m,...

11 years ago | 1

| accepted

Answered
Select some elements from a given matrix
Assuming you don't care about the order in which they are selected: m(randperm(numel(m),3)) If you want to preserve the ...

11 years ago | 0

| accepted

Answered
Stuck in Indexing of a Matrix(or Cell Array)
E.g., using the cell array approach: m= ['A','B','C']; cs=size(m,2); new_M = cell(cs*(cs-1),1); % Pre-allocate your c...

11 years ago | 0

| accepted

Answered
please anyone convert this c++ code into MATLAB
Making assumption that l is the string length (a really *BAD* choice for a variable name btw), here is a fairly literal translat...

11 years ago | 0

Answered
Matlab ROUND function not rounding small decimals away
It is just a display issue and the fact that IEEE double cannot represent the numbers exactly. E.g., >> num2strexact(66.6...

11 years ago | 1

| accepted

Answered
How do I map a horizontal component of any vector?
Not at all sure what you mean. If you have a velocity vector v that is a 3-element vector, where the third element is the vertic...

11 years ago | 0

Answered
how to calculate digits after decimal point?
See this related thread: http://www.mathworks.com/matlabcentral/answers/142819-how-to-find-number-of-significant-figures-in-a...

11 years ago | 2

| accepted

Answered
Open matlab in fortran environment
The general advice here is 1) Have MATLAB call your Fortran code as a mex routine, and then use the mexCallMATLAB functio...

11 years ago | 0

Answered
Need help with for and while loops.
Matrix Multiply: Start with the MATLAB doc for this, in particular the formula for the element C(i,j) of the result from this pa...

11 years ago | 0

| accepted

Answered
Could anyone help me with an anonymous function trouble please?!
Make the argument of myfun a vector. E.g., myfun = @(x) ((x(1) - 2).^4 + (x(1) - 2*x(2)).^2 + (x(1).^2 - x(2)).^2); fmin...

11 years ago | 1

Load more