Answered
How can I sum logical relations between elements of a vector?
You can use <http://www.mathworks.com/help/matlab/ref/bsxfun.html |bsxfun|> to do this quite easily: >> x = [1,2,3]; >> ...

10 years ago | 0

| accepted

Answered
function with variable amount of inputs
Use <http://www.mathworks.com/help/matlab/ref/nargin.html |nargin|>: function myfun(x1,y1,x2,y2) switch nargin ca...

10 years ago | 0

| accepted

Answered
How can I change the color of a single data point of a scatter plot by using handles?
Why just _think_ something when you can read the documentation and _know_? The function <http://www.mathworks.com/help/matlab...

10 years ago | 1

Answered
How to use regexp to return a variable (pos or neg and either decimal or scientific) from a text file?
This will match any integer or decimal, with optional exponent, and optional sign: '(+|-)?\d+(\.\d+)?(E(+|-)?\d+)? The ex...

10 years ago | 0

| accepted

Answered
Syntax Issue in If Statement Using Handles
You cannot test for equality of <http://www.mathworks.com/help/matlab/ref/nan.html NaN>'s, because as the documentation clearly ...

10 years ago | 0

| accepted

Answered
How do you write to a fopen text file without deleting previous text?
Simply use the append option |a|: fileID = fopen('myfile.txt','a+'); That is it.

10 years ago | 3

Answered
Finding the first zero element in a row and fill the entire row with the last non zero element
>> A = [1,3,1,0,0,0,0;1,4,2,1,3,4,1;2,3,1,2,3,3,0] A = 1 3 1 0 0 0 0 1 4 2 ...

10 years ago | 0

| accepted

Answered
How to find the least number of lists (in a set of given lists) to cover all elements of a reference list
This should get you started: V = {A,B,C,D,E}; N = numel(V):-1:1; Z = []; for k = N M = nchoosek(N,k); ...

10 years ago | 0

Answered
I'm trying to convert an if statement to a switch statement
If you are copying lines of code then you are doing it wrong. One simple <http://www.mathworks.com/help/matlab/ref/find.html |fi...

10 years ago | 0

Answered
How to process a folder of Images?
<http://www.mathworks.com/matlabcentral/answers/57446-faq-how-can-i-process-a-sequence-of-files> <http://matlab.wikia.com/wik...

10 years ago | 0

| accepted

Answered
merging column elements into one
Use <http://www.mathworks.com/help/matlab/ref/datestr.html |datstr|> and <http://www.mathworks.com/help/matlab/ref/cellstr.html ...

10 years ago | 0

Answered
Merge matrices into one matrix based on column order
You don't tell us anything about _how_ you are reading these file into MATLAB, so here is a general overview of how to solve you...

10 years ago | 1

| accepted

Answered
Output argument "x" (and maybe others) not assigned during call to "function".
Look at your fucntion |reproductie|: function [ziektekiemen,buurvelden]=reproductie(z,a,target) if z<=target ziek...

10 years ago | 0

| accepted

Answered
Undefined function 'times' for input arguments of type 'cell'.
You created a <http://www.mathworks.com/help/matlab/cell-arrays.html cell array> on this line by using the curly braces |{}|: ...

10 years ago | 0

Answered
How to join character
>> old = sprintf('Institution/College\nName') old = Institution/College Name >> new = regexp(regexprep(old,'\s+',' ')...

10 years ago | 0

Answered
Undefined function or variable 'VanDerCorput'
Have a look at these lines: for l=1:NbTraj u1(l)=norminv(VanDerCorput(l,3)); u2(l)=norminv(VanDerCorput(l,5)); e...

10 years ago | 0

| accepted

Answered
Deleting Repeated Rows in a matrix
<http://www.mathworks.com/help/matlab/ref/unique.html> unique(X,'rows','stable')

10 years ago | 1

Answered
index rows containing specific value
Using a cell array is a total waste of MATLAB's abilites for processing numeric arrays quickly and efficiently. You would be muc...

10 years ago | 0

| accepted

Answered
Matrix from vectors (dynamic number of columns)
Putting all of your data into separate variables is a really bad idea, so the first thing to do is to save them in one matrix (I...

10 years ago | 0

Answered
How to extract only alphabets from mixed string
This is easy using the inbuilt <http://www.mathworks.com/help/matlab/ref/isstrprop.html |isstrprop|> function: >> S = 'BA9K...

10 years ago | 1

| accepted

Answered
Delete rows from matrix?
Just use some basic MATLAB logical indexing: >> X = M(M(:,1)~=0,:) X = 1 1 2 6 3 5 ...

10 years ago | 0

| accepted

Answered
how to find subsets of different matrices
Numbered variables are a bad idea. Using numbered variables will make writing code harder. So the first thing to do is put all o...

10 years ago | 1

| accepted

Answered
How do I read a .txt file ?
fid = fopen('filename.txt','rt'); C = textscan(fid,'%s%f%f','headerlines',1); fclose(fid); name = C{1}; LatN = C{2}; ...

10 years ago | 0

| accepted

Answered
delete first x number of rows from a cell array
>> C = num2cell([randi(9,6,3),[0;0;0;1;2;3]]) C = [5] [8] [6] [0] [2] [3] [5] [0] ...

10 years ago | 1

| accepted

Answered
i want to find row indices for each column having non zero values
An easy way using <http://www.mathworks.com/help/matlab/ref/accumarray.html accumarray>: >> a = [1,1,0,1;1,1,0,0;0,0,1,1] ...

10 years ago | 1

| accepted

Answered
Help with matrix manpulation.
M = [1,2,3;3,2,1;2,3,1]; X = [1,0,0;1,3,0;3,0,0]; % [row,col] = find(X); col = X(X>0); idx = sub2ind(size(M),ro...

10 years ago | 0

| accepted

Answered
How to check if a directory(folder) exists?
Use exist like this: 7==exist(name,'dir') % check if folder exists or 7~=exist(name,'dir') % check if folder does NOT exist ...

10 years ago | 7

Answered
How to read multiple images at once?
Not |eval| is not used, to make the code much faster and more reliable. sPath = 'myDir'; sFile = '*.jpg'; sFull = ful...

10 years ago | 0

| accepted

Load more