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

casi 12 años hace | 1

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

casi 12 años hace | 0

Respondida
Allocating values in a 3D array using nested for loops
Since this is apparently a homework assignment, I will get you started. Since the requirement is to use nested loops, I assume t...

casi 12 años hace | 5

| aceptada

Respondida
mex difference between mwPointer and pointer in Fortran90
An mwPointer is simply a macro that translates into a signed integer (32-bit or 64-bit) in Fortran. It is used to store memory a...

casi 12 años hace | 0

| aceptada

Respondida
how to normalize a matrix?????
Assuming values are positive, e.g., M = your matrix N = bsxfun(@rdivide,M,max(M)); % Normalized (scaled) matrix by colum...

casi 12 años hace | 2

Respondida
Pick out rows one by one from a vector to use as initial values in differential equation?
Do you mean something like this? initial_conditions_matrix = (a 100 x 4 matrix) m = size(initial_conditions,1); for k...

casi 12 años hace | 1

Respondida
Error using - Matrix dimensions must agree. HELP
The best course of action usually is to get into the debugger and stop your code at the line that is generating the error, and t...

casi 12 años hace | 0

Respondida
&& in if statement returning error
It appears you have a vector involved in your test, e.g., d_0_ij(1:sz_dist_obs(1,1),1) == distance_obs(1,1) As written, ...

casi 12 años hace | 0

Respondida
Hot to display a variable from a row ?
Looks like a typo, missing ' in your code. Try this: disp(['m34= ' num2str(m34(j))]);

casi 12 años hace | 2

Respondida
mixed programming technology of Matlab and C/C++
Have you looked at the details in the doc? E.g., here: http://www.mathworks.com/help/matlab/programming-interfaces-for-c-c-fo...

alrededor de 12 años hace | 1

Respondida
Bug in matlab R2012b version
Others have already adequately answered your question. But to help you gain a better understanding of this I will point you to a...

alrededor de 12 años hace | 3

Respondida
Sum(X) = 1 but Sum(X)==1 produces logical 0
Note that when a number is exactly an integer, and you are only printing one scalar value, MATLAB prints it without any trailing...

alrededor de 12 años hace | 0

Respondida
Replacing all values except NaN with column number
E.g., y = floor(rand(6,3)*100); y(2:6,3) = nan; % test data z = repmat(1:size(y,2),size(y,1),1); z(isnan(y)) = nan...

alrededor de 12 años hace | 0

| aceptada

Respondida
How to find number of significant figures in a decimal number?
This is not necessarily trivial to do reliably. In the first place, 31.456 is not representable in IEEE double exactly, so those...

alrededor de 12 años hace | 5

| aceptada

Respondida
Question about mexfunction link to dll
I usually explicitly put the name of the lib file directly on the mex command. E.g., try something like this assuming the lib fi...

alrededor de 12 años hace | 1

| aceptada

Respondida
Error in using mldivide in mex
You don't need to create plhs[0] explicitly since the mexCallMATLAB call will do that for you. Also, you don't need to explicitl...

alrededor de 12 años hace | 0

| aceptada

Respondida
Is there a way to create all m files with already filled in some predetermined lines that are needed for every file like clear all; close all; author name etc?
Have a template file sitting out there (e.g. mytemplate.m) that has a function outline & comments (author etc) already filled in...

alrededor de 12 años hace | 0

Respondida
ind2sub doesn't work
The typical use of ind2sub in your case is to request two outputs: [I J] = ind2sub(size(tmp), maxInd) I = 3 J...

alrededor de 12 años hace | 2

Respondida
Remove a specific dimension
If you *know* the first dimension is always a singleton at some point in your calculation, you can use reshape instead of squeez...

alrededor de 12 años hace | 8

| aceptada

Respondida
please help,....how to fix this one,....??? Input argument "D" is undefined. Error in ==> MSA at 2 m=D.m;n=D.n;Ni=zeros(12,12,m);S=zeros(6*n);Pf=S(:,1);Q=zeros(12,m);Qfi=Q;Ei=Q;
The error is saying that you called the MSA function without supplying any arguments. E.g., if you did something like this: ...

alrededor de 12 años hace | 0

Respondida
Filter out nonzero number in array of n*2 dimension.
If I understand your question, you want to delete the rows with non-zero entries in both columns, e.g., idx = sum(A~=0,2)==...

alrededor de 12 años hace | 1

Respondida
How to add matrices in a function with varying input arguments
Do you mean simply adding up all of the varargin individual inputs, like this? if( nargin ) matrix_sum = varargin{1}...

alrededor de 12 años hace | 1

| aceptada

Respondida
When to use mex files?
First thing to do is use the profiler and let MATLAB tell you where it is spending most of the time. Then you can decide on what...

alrededor de 12 años hace | 0

| aceptada

Respondida
Mean Function with Matrix
There *are* five values listed. Each of the five values in the 2nd row is multiplied by the factor 1.0e-3. It is MATLAB's way of...

alrededor de 12 años hace | 2

| aceptada

Respondida
increase vector with mex function
I don't know about the CUDA stuff, but you have a basic mismatch of types in your C code. E.g., v = ones(100,1); The abo...

alrededor de 12 años hace | 0

| aceptada

Respondida
Simple mex function help
You have defined x and y in mexFunction to be *pointers* to double, not double. But your xtimes10 routine is expecting double, n...

alrededor de 12 años hace | 1

| aceptada

Respondida
How to create a vector out of arrays
I am guessing that Header is a cell array of strings, even though you have typed it in your post using parentheses ( ) instead o...

alrededor de 12 años hace | 0

Respondida
addressing elements in a cell aray of cells
Not sure what your actual desired outcome is, but this syntax works to replace the 'eeg2' with 'eeg3': new{1,2}(2) = {'eeg3...

alrededor de 12 años hace | 0

| aceptada

Respondida
While Loop Problem Displaying NaN
If you check this link, you will see that the series you are using only converges for abs(x) <= 1 and x not equal to -1: http...

alrededor de 12 años hace | 0

Respondida
ERROR USING VERTCAT HELP PLEASE
It is unclear what you are trying to do with the loop. P is a vector [100 200 ... 1000], so the for loop indexing i=1:P doesn't ...

alrededor de 12 años hace | 1

| aceptada

Cargar más