Respondida
Extract matrices of a particular size
C = your cell array DesiredSize = whatever; % e.g. [1 16] Z = cellfun(@size,C,'UniformOutput',false); % get matrix sizes ...

más de 11 años hace | 0

Respondida
How do I create random Boolean array with at least one 1 in each row?
For a row, e.g., n = number of random numbers in a row row = randi(2,1,n)-1; while( ~any(row) ) row = randi(2,...

más de 11 años hace | 0

Respondida
How do I use a 2D logical index matrix to change a subset of a 3D array?
data(cond(:)) = nan; % Use linear indexing since target is 1st plane

más de 11 años hace | 0

Respondida
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 ...

más de 11 años hace | 0

Respondida
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...

más de 11 años hace | 0

Respondida
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 ...

más de 11 años hace | 1

Respondida
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"); ...

más de 11 años hace | 0

Respondida
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...

más de 11 años hace | 0

Respondida
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

más de 11 años hace | 0

Respondida
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...

más de 11 años hace | 0

Respondida
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...

más de 11 años hace | 0

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

más de 11 años hace | 0

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

más de 11 años hace | 5

| aceptada

Respondida
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...

más de 11 años hace | 0

| aceptada

Respondida
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...

más de 11 años hace | 1

| aceptada

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

más de 11 años hace | 0

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

más de 11 años hace | 2

| aceptada

Respondida
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'.

más de 11 años hace | 0

Respondida
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...

más de 11 años hace | 1

Respondida
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...

más de 11 años hace | 0

| aceptada

Respondida
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...

más de 11 años hace | 1

| aceptada

Respondida
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 .*...

más de 11 años hace | 0

Respondida
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)),:);...

más de 11 años hace | 2

Respondida
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,...

más de 11 años hace | 1

| aceptada

Respondida
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 ...

más de 11 años hace | 0

| aceptada

Respondida
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...

más de 11 años hace | 0

| aceptada

Respondida
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...

más de 11 años hace | 0

Respondida
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...

más de 11 años hace | 1

| aceptada

Respondida
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...

más de 11 años hace | 0

Respondida
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...

más de 11 años hace | 2

| aceptada

Cargar más