Respondida
Fundamental question: How does MATLAB calculate the sine function?
MATLAB doesn't publish all of their function algorithms, but I would guess it would be range reduction followed by a rational fu...

más de 9 años hace | 0

Respondida
Select from 2D Array by 2 criteria - Matlab
Try this: y = your 2D matrix x = y(:,2) > 0.9 & y(:,2) <= 1.2; z = y(x,:); [~,k] = max(z); result = z(k,:);

más de 9 años hace | 1

| aceptada

Respondida
Undefined Variable; Q7day, help! Thank you
If you never get inside the for loop, Q7day will not get defined and that last line will error. Run your code in the debugger a...

más de 9 años hace | 0

Respondida
passing a structure pointer from C mex file to matlab
The usual hack is to encapsulate the pointer in a MATLAB uint64 variable. I.e., set the data area of a uint64 mxArray to the va...

más de 9 años hace | 0

| aceptada

Respondida
Matlab crashed when I run my mexFunction, anything wrong?
Several errors in the code that would result in a crash: bus_CTCALC_SIM_INPUT *pInputBus; : /* get a...

más de 9 años hace | 0

| aceptada

Respondida
Store severals matrix M by N by 3 in one 4D matrix-Demosaicing image Raw data
I am confused about why you are apparently using the same variable name "I" for the individual images and your stacked images: ...

más de 9 años hace | 0

| aceptada

Respondida
Help with a code calculating ?
Maybe put this at an appropriate place in your code: if( n == 10 ) break; end

más de 9 años hace | 0

Respondida
Normal Random number generation
Maybe this link will help you: <https://www.mathworks.com/matlabcentral/answers/325625-how-do-i-create-random-normally-distri...

más de 9 años hace | 1

| aceptada

Respondida
matlab indexing and swapping
This isn't going to work like you hoped. If you delete an element from the array with this line: x(n) = []; Then ther...

más de 9 años hace | 0

| aceptada

Respondida
What is wrong with this code - if and else if statements
Change all of your rent1, rent2, etc variables to just rent, since that is what you print. Also, to make things simpler on th...

más de 9 años hace | 1

| aceptada

Respondida
How to delete rows while maintaining the indexes?
You can't do that with arrays in MATLAB. The contents cannot be "null" but still present for indexing purposes ... they have to...

más de 9 años hace | 0

| aceptada

Respondida
MATLAB freezes for a few minutes whenever I run a Fortran executable
Sounds like the Fortran exe is using all of the CPU in your new setup, whereas it didn't before. E.g., maybe it didn't run mult...

más de 9 años hace | 0

Respondida
Running the same MATLAB version twice and simultaneous and in the same computer.
What do you mean by "safe"? To run an m-file file, MATLAB first reads the file into memory (and parses it etc). Then the act...

más de 9 años hace | 0

Respondida
Why matlab 2016b makes the difference between a vector column and row vector
Lots of discussion about this on the NG: http://www.mathworks.com/matlabcentral/newsreader/search_results?search_string=Petr ...

más de 9 años hace | 0

Respondida
detestr/datenum behavior on Jan 1st.
The 0'th day of January is interpreted as 31st December of the previous year. Makes sense to me. E.g., >> datestr(datenum...

más de 9 años hace | 1

| aceptada

Respondida
what is the meaning ???
You don't show the entire code, but my guess would be this is inside a function that looks something like this: function ou...

más de 9 años hace | 2

| aceptada

Respondida
Creative ways of calculating tomorrow. I need help with my very basic script and some info on how to assign values to string and recalling the string from the number.
In general, don't use the == operator to compare strings. The == operator will produce an element-by-element result and that is...

más de 9 años hace | 0

Respondida
ODE with matrix DYNAMIC problem
If M, C, and K are all 4x4, then I would conclude that x must be a 4x1 vector. If this is true, then you have four 2nd order equ...

más de 9 años hace | 0

Respondida
Matlab crashed when call mexCallMATLAB
(1) These lines are wrong: ir = mxGetIr(pmxIn[0]); jc = mxGetJc(pmxIn[0]); pin = mxGetPr(pmxIn[0]); A = ...

más de 9 años hace | 1

| aceptada

Respondida
Using RAM by mex-function
I haven't looked over your code in any detail, but this line definitely raises a red flag: FullVec U[NR+2][NZ+2]; U is a...

más de 9 años hace | 0

| aceptada

Respondida
Replace certain elements in a matrix with another part of the matrix
E.g., assuming there is enough room: y = your array x = y < 0; n = sum(x); y(x) = y(1000:1000+n-1); Or another ...

más de 9 años hace | 0

| aceptada

Respondida
Plotting the tragectory in MATLAB
In your Gravity function you have some variable name inconsistencies. E.g., function dRV = Gravity(t, RV) global T X_J ...

más de 9 años hace | 0

| aceptada

Respondida
how can I extract matrix elements from 1 matrix that correspond to a 2 nd matrix and place them in a 3rd matrix
Define C with a specific size first, then replace the appropriate elements. What you are doing is defining C as only those eleme...

más de 9 años hace | 0

| aceptada

Respondida
How do I combine digits from different cells into one cell?
For numeric result, e.g., result = 100*X(:,1) + 10*X(:,2) + X(:,3); For a character result, e.g., result = char(X+'...

más de 9 años hace | 1

| aceptada

Respondida
Repeat for loop until condition is met.
It would be easier to use a while loop. E.g., modifying your code and replacing your for-loop with a while-loop: % Insert...

más de 9 años hace | 1

| aceptada

Respondida
How to delete some specific rows in a cell matrix?
r = any(cellfun(@(x)isequal(x,'youth'),A),2); % Rows that contain 'youth' A(r,:) = []; % Delete those rows

más de 9 años hace | 0

Respondida
Mex fortran code on Matlab R2013a, Linux 64: Illegal preprocessor directive
The warning indicates that something went wrong with the pre-processor. The error indicates that mwPointer is not defined. Wha...

más de 9 años hace | 1

Respondida
A Matrix full of Arrays
Use cell arrays. E.g., myMatrix = {1:2,1:3,1:4}; % <-- 3-element cell array of row vectors, each a different length myV...

más de 9 años hace | 0

| aceptada

Respondida
how to remove specific rows of columns
Save the indexing that you use to do the removing, and then apply that to the original matrix during the reconstruction. E.g., ...

más de 9 años hace | 0

| aceptada

Respondida
Problem with mean function
What does this show: sum(condition) If sum(condition) is 0, then you will get a NaN result in the mean calculation. E.g....

más de 9 años hace | 0

Cargar más