Answered
For loop code not working right?
You have used the variable p9 as your loop index AND as the accumulation variable. Use a different variable name for the loop in...

12 years ago | 1

Answered
Sending big sparse matrix to C through mex: matlab crashing
Sparse matrices are not stored in memory the same way that full matrices are. In particular, the 0's are not physically stored. ...

12 years ago | 2

| accepted

Answered
mex File not Recognized
As Jan has already pointed out, "The specified module could not be found" message means that the SMAT_matlabcall.mexw32 file its...

12 years ago | 0

Answered
Count number of matrix elements in a given vector
M = 30 x j matrix of random ordered numbers 1:30 C = 30 x 1 "correct" ordering of 1:30 N = sum(bsxfun(@eq,M,C)); % Numbe...

12 years ago | 1

| accepted

Answered
How can I insert vectors created in a for loop in a matrix?
E.g., wpvector = 0:0.5:5; % Create a vector the same size as the loop range k = 0; % Initialize the index into this vec...

12 years ago | 1

Answered
Solving a vector system
HINT: What do you get when you add the two equations together? And what do you get when you subtract the two equations? Just do ...

12 years ago | 0

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

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

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

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

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

12 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);

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

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

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

12 years ago | 0

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

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

12 years ago | 2

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

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

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

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

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

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

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

12 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(:...

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

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

12 years ago | 0

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

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

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

12 years ago | 0

Load more