Answered
Mex file crashes matlab but then after I continue gives expected output
Mex files that crash MATLAB usually have bugs in them, likely memory related. Something in MATLAB memory got corrupted. It is ...

10 years ago | 0

| accepted

Answered
Solving ODE system on matlab
Your plot3 only picks off three points to plot ... it does not plot all of the results. Also, your model derivative function se...

10 years ago | 0

Answered
How can I correct a rounding error??
Welcome to the world of floating point arithmetic. See this post: http://www.mathworks.com/matlabcentral/answers/69-why-does-...

10 years ago | 0

Answered
Which computer programming language are MATLAB R2015b and R2016b written in?
Java for the interface, C++ for computational library stuff, and some 3rd party libraries for some of the matrix algebra BLAS an...

10 years ago | 5

Answered
How to invert the function typecast?
Don't open the file as a text file with 'wt'. Instead, open it as binary by leaving off the 't' part. E.g., fid = fopen('as...

10 years ago | 0

| accepted

Answered
How do I incorporate the structure array into the while loop? I need help ASAP! TYIA.
Look at your first two lines: n=1; while n>1 Since n>1 is not true, you will never get into that while loop and nothi...

10 years ago | 0

| accepted

Answered
4th order Runge-Kutta Method Help
You never set the z2 elements inside your loop, so on the second iteration when z2(i-1) is used (with i=3) z2(2) does not exist....

10 years ago | 0

| accepted

Answered
Access elements of sparse matrix without find()
If you store this matrix as sparse, then yes the (1,1) 0 element will not be physically stored and cannot be recovered with find...

10 years ago | 0

| accepted

Answered
convert struct field in cell array
Do you mean like this: for k=1:numel(result.objList) result.objList(k).objectClass = result.objList(k).objectClass.o...

10 years ago | 0

Answered
Comparing strings, case insensitive, without str functions
Do you know how to compare, in a case insensitive way, whether two characters are equal or not? Once you can do that, just put i...

10 years ago | 0

| accepted

Answered
Generate a bit stream of 1s and 0s in Matlab, the bit stream should have a uniform random distribution. The bit stream should have a length N=100000.
You didn't ask a question. But looking at your code, did you mean to use bit_stream instead of stream? E.g., stem(bit_str...

10 years ago | 0

| accepted

Answered
Why isn't my code working?
You need to enclose the denominator in parentheses: Q1=(-b-sqrt(b^2-4*a*c))/(2*a); The way you have it coded, since / an...

10 years ago | 1

Answered
For loop isn't working, unsure as to why
I think you meant for this to be a double for loop. As coded, you only have one for loop and j is a vector. E.g., is this what ...

10 years ago | 1

| accepted

Answered
Whats wrong with my quadratic formula?
You need to enclose the denominator in parentheses: Q1=(-b-sqrt(b^2-4*a*c))/(2*a); The way you have it coded, since / an...

10 years ago | 0

| accepted

Answered
Can I pre-set save-filename, just like in C?
Do you mean something like this? datafile = '01.dat'; AA = ['output_' datafile]; % <-- Concatenate your root name with ...

10 years ago | 0

| accepted

Answered
Passing a string variable between my c++ code to matlab
First, once you are done using the mxArray variables, destroy them. E.g., at the end of your code do this: mxDestroyArray(...

10 years ago | 1

| accepted

Answered
Remove certain elements from a matrix
Replace this: % Remove points where there are zeros for i = 1:length(OldData) if(OldData(i,2) == 0) ...

10 years ago | 0

Answered
Matrix sorting, smallest to biggest
After your loop, add this line: a = a'; The reason you are getting the result column-ordered instead of row-ordered is b...

10 years ago | 0

Answered
Want to get only characters after using bin2dec.
If you are shuffling the bits around, then you are likely getting resulting characters that are in the "non-printable" set ... i...

10 years ago | 1

Answered
Matlab code help on Euler's Method
Here is a general outline for Euler's Method: % Euler's Method % Initial conditions and setup h = (enter your step si...

10 years ago | 12

| accepted

Answered
Marking pixels above a certain value
Hint for the 1st part, G = (insert code here to pick off the green plane) mark_green = G >= 0.5; % the marked pixels ...

10 years ago | 1

| accepted

Answered
Write a user defined function psum to approximate the value of the sum
Here is a start. It's a basic outline of the summing code with only a couple of lines for you to fill in. You will also need to...

10 years ago | 0

Answered
Modeling the radio-active decay using ode23
For starters, you have t and x reversed in the argument list of the derivative function f1. Also, it seems to me that the rate ...

10 years ago | 0

| accepted

Answered
Matrix of structures/matrix of column vectors
Using cell arrays: combi = cell(m,n); for k=1:m*n combi{k} = [R(k);G(k);B(k)]; end Then you can get at each...

10 years ago | 1

| accepted

Answered
Euler Method on without ODE
When calling a function file, MATLAB calls it based on the *filename*, not the function name listed on the function line in the ...

10 years ago | 0

Answered
how to calculate all permutations of ['a' 'b' 'c' ... 'x' 'y' 'z'] just 26 characters, yet combinator.m combinations.m return errors
"... does any one know how can i, even if only one by one, go through all permutations of ..." I could post code to do this, ...

10 years ago | 2

Answered
sum() fails while operating on a large array of single floats
My guess is this is caused by using single precision accumulators for the sums at the low level code. If you were to write a si...

10 years ago | 2

| accepted

Answered
Criss-cross indexing of array elements
Try this using linear indexing as you suggested: z = size(A); mn = z(1) * z(2); x = (1:mn)' + (B(:)-1)*mn; C ...

10 years ago | 0

| accepted

Answered
Error using plot Conversion to double from function_handle is not possible.
y is a function_handle, so you have to pass it some data. plot(x,y(x)) What you did was basically equivalent to this: ...

10 years ago | 1

| accepted

Load more