Answered
How to access Matlab string() data in MEX/C?
I don't have a recent enough version of MATLAB & C compiler to check this, but I suspect that the string class is an OOP classde...

9 years ago | 1

Answered
Only first for loop is being executed. What im i doing wrong?
It is a bit unclear why you are attempting to use for-loops here. From the looks of things, it appears that maybe you need to u...

9 years ago | 1

| accepted

Answered
output from an if statment
These statements: zn=cell(1,fx); zn(l)=zs(1); The first statement above wipes out any previous values/cells...

9 years ago | 0

Answered
Putting different outputs in one vector matrix
Is this what you want? x = 1:9; % a vector with elements 1, 2, ..., 9 y = sin(x) - cos(x); % the vector result at each...

9 years ago | 0

| accepted

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

9 years ago | 0

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

9 years ago | 1

| accepted

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

9 years ago | 0

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

Load more