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

9 years ago | 0

| accepted

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

9 years ago | 0

| accepted

Answered
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: ...

9 years ago | 0

| accepted

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

9 years ago | 0

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

9 years ago | 1

| accepted

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

9 years ago | 0

| accepted

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

9 years ago | 1

| accepted

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

9 years ago | 0

| accepted

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

9 years ago | 0

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

9 years ago | 0

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

9 years ago | 0

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

9 years ago | 1

| accepted

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

9 years ago | 2

| accepted

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

9 years ago | 0

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

9 years ago | 0

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

9 years ago | 1

| accepted

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

9 years ago | 0

| accepted

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

9 years ago | 0

| accepted

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

9 years ago | 0

| accepted

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

9 years ago | 0

| accepted

Answered
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+'...

9 years ago | 1

| accepted

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

9 years ago | 1

| accepted

Answered
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

9 years ago | 0

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

9 years ago | 1

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

9 years ago | 0

| accepted

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

9 years ago | 0

| accepted

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

9 years ago | 0

Answered
Writing a taylor series function for e^x
You are missing the first term in the series (i.e., the 1). You could rectify this by modifying the sum line. E.g., ts = 1 ...

9 years ago | 0

Answered
Compare and remove entries from matrix
Do *NOT* delete items from a matrix in a loop! Every time you do so, it causes an entire data copy to take place. If you do th...

9 years ago | 0

Answered
Find and delete a double value in matrix
Use randperm, not randi. The randperm function will ensure that you do not get duplicate indexes to delete, whereas using randi...

9 years ago | 0

Load more