Answered
Partial Sums Using For Loop
You replace the "a" variable with each iteration, so only the last iteration is present when you do "sum(a)". So either make "a"...

11 years ago | 1

| accepted

Answered
taylor function is not working
It is complaining about the 5 and 0 arguments, which don't match the expected syntax for calling the taylor function. Is somethi...

11 years ago | 0

Answered
Run multiple versions of Matlab on shared server
If you are simply asking if it is possible to have multiple versions of MATLAB installed on the same machine, the answer is yes....

11 years ago | 0

Answered
element wise multiplication (beginner)
c is a 1x7 row vector (built with spaces or commas separating the elements) d is a 7x1 column vector (built with semi-colon s...

11 years ago | 1

| accepted

Answered
Beginner's Mex Error - MatLab
Check the associated mexopts file for the specific compiler/linker setup you are using and look for the COMPFLAGS line. If there...

11 years ago | 1

Answered
Replace NaN with corresponding elements in another array.
A = original array with NaNs in it B = array with desired replacement values x = isnan(A); A(x) = B(x);

11 years ago | 5

Answered
compiling C and fortran files in MATLAB mex
First compile adwrite.c by itself with a C compiler to generate an object file (e.g., adwrite.obj on Windows). If you are doing ...

11 years ago | 0

| accepted

Answered
How to change 4x4 matrix to 2x2 matrix
Yet another way (not necessarily any better than other posts), generalized: kr = 2; kc = 2; % Row and Column sizes of sub-b...

11 years ago | 1

Answered
This code plot nothing and i don't understand why ?!
size(x) and size(u) are vectors, so i<= size(x)& j<=size(u) is a vector result, which is not what you likely intended. Try using...

11 years ago | 0

Answered
how create an array 33x2000?
A = zeros(33,2000); A = ones(33,2000); A = nan(33,2000); etc.

11 years ago | 0

| accepted

Answered
Most Efficient Way of Using mexCallMATLAB in Converting Double* to mxArray*
Preliminary comment: You should not pre-allocate the G_PINV_output, since this will be automatically created by the mexCallMATLA...

11 years ago | 2

Answered
How can I find min between three value in matlab?
min([a b c])

11 years ago | 1

| accepted

Answered
Error using round(reshape(message,Mm*Nm,1)./256)
What does the error message say? Double check the size of the variable message to make sure it really is Mm x Nm. Note th...

11 years ago | 1

Answered
how do i plot a graph in xy?
Do you mean y = x^3? If so, first pick a range for x, then calculate y, then plot it. E.g., x = 0:0.1:3; % From 0 to 3 in i...

11 years ago | 0

Answered
Multiplying matrices of different classes
For the first part of your question, to do a matrix multiply: a = your double matrix b = your uint8 matrix c = a * do...

11 years ago | 2

Answered
2 dice simulation. Code for when both dice = 6?
sum((a==6)&(b==6)) Looks like the same question as this newsgroup thread: http://www.mathworks.com/matlabcentral/newsrea...

11 years ago | 1

| accepted

Answered
How to convert squareroot and arctan function to VHDL?
This doesn't really sound like a MATLAB problem to me, and I am not sure you will get much help on this forum. There are a varie...

11 years ago | 0

Answered
how to use randperm with a seed?
In general you will get a different set by default, but it is possible to get the same set. If you want to preclude this I would...

11 years ago | 0

Answered
Pass one value at a time from a matrix to a for loop
E.g., (caution: code not protected against iprev too large for matrix size) iprev = 1; for ii = find(isemp) ave(:...

11 years ago | 0

| accepted

Answered
What is wrong with my code? (Beginner's question)
func1: x and y are outputs of this function, not inputs. So eliminate them from the calling arguments. E.g., function [x...

11 years ago | 1

Answered
Error in save to .txt
Where are you running the code from? Can you switch to a working directory where you do have write capability before doing the s...

11 years ago | 0

Answered
Creating a new matrix from two matrixes
c = zeros(size(a)); c(b,:) = a(b,:);

11 years ago | 0

| accepted

Answered
How to output WHOLE vector in result?
Your function, as written, takes two inputs and returns two outputs. You probably called your function with only one output whic...

11 years ago | 1

Answered
after command bottom, I want X=[d2;d4;d9]
Is this what you want? Basically repeated your code, but get rid of the zeros initialization which will make X a double array (n...

11 years ago | 0

Answered
Euler's Method (Once again)
See this link under "Formulation of the method": http://en.wikipedia.org/wiki/Euler%27s_method

11 years ago | 0

Answered
How to do Runge Kutta 4 with a second order ode?
What is the signature for ode1? I can't seem to find it in the doc. Where is your derivative function implemented? I don't see i...

11 years ago | 0

| accepted

Answered
how do i obtain several output with a "function" function?
Please see this related post: http://www.mathworks.com/matlabcentral/answers/57445-faq-how-can-i-create-variables-a1-a2-a10-i...

11 years ago | 0

Answered
How to remove the last column in an array
Another method: a(:,end) = [];

11 years ago | 2

Answered
how to create function without having to use all the inputs in the script
Use nargin in your function to determine how many inputs are actually being passed in. E.g. function T = Tavg(a,b,c,d) i...

11 years ago | 1

Answered
Converting Covariance Matrix to Correlation Matrix
A method using outer product and element-wise divide: d = sqrt(diag(cov)); corr = cov./(d*d');

11 years ago | 0

Load more