Réponse apportée
Cogent and Matlab2013b compatibility?
The cogent toolbox is very old. It might simply not work with recent MatLab releases or even with windows newer than XP. You cou...

presque 12 ans il y a | 0

Réponse apportée
How to store indexed values from a for loop
Like with C, you can store them in a cell array v = cell(size(C)) for j=1:numel(C) ... [K, v{j}] = convexH...

presque 12 ans il y a | 0

| A accepté

Réponse apportée
Giving names to different files automatically
Maybe you can use structures? MyStructure.A = 8 ; MyStructure.B = 1:5 ; MyField = 'A' result = 2 * MyStructure...

presque 12 ans il y a | 0

Réponse apportée
Giving names to different files automatically
Rethink your programming style critically. The basic idea about variables is that their contents change during execution of the ...

presque 12 ans il y a | 0

Réponse apportée
Cogent and Matlab2013b compatibility?
Have you added the folder with a all the functions to the matlab path? what does, for instance, which cgopen give you?

presque 12 ans il y a | 0

Réponse apportée
Binornd draws '1' every time
what if you execute which binornd just before the calls? Do the outputs differ based on the situation (script vs. comman...

presque 12 ans il y a | 0

Réponse apportée
How do I smooth a plot ?
You want to apply 2D (3D?) smoothing filters, which is quite easy if you have the signal processing toolbox. You can also search...

presque 12 ans il y a | 0

Réponse apportée
Adding vertical line to plot?
You might also be interested in GRIDXY on the File Exchange: <http://www.mathworks.com/matlabcentral/fileexchange/9973-gridxy...

presque 12 ans il y a | 0

Réponse apportée
find X of corresponding local minima
Finding minima of a signal X is the same as finding the maxima of the signal *-X*

presque 12 ans il y a | 0

| A accepté

Réponse apportée
Can someone give me a quick project to write?
Programming these games will learn you about flow control, contingencies, matrices, graphics, input validation, etc: (in order o...

presque 12 ans il y a | 0

| A accepté

Réponse apportée
create 3*3 matrix around a given pixel
One solution: img = zeros(6,7) a = [4 3] img(a(2),a(1)) = 1 B = [1 1 1 ; 1 0 1 ; 1 1 1]; img2 = conv2(img, B ,'...

presque 12 ans il y a | 0

| A accepté

Réponse apportée
Taking the mean of rows in a structure array
I assume NM is your 300 element structure array. with NM(k).data holding the 3453 data points of the kith element of the struct...

presque 12 ans il y a | 0

Réponse apportée
Find numeric columns in a cell array
% C is a cell array, like C = {1 2 3 4 5 ; 11 '12' 13:15 14 []} q = cellfun(@(x) isnumeric(x) && numel(x)==1, C) % tru...

presque 12 ans il y a | 1

| A accepté

Réponse apportée
x and y intercepts
You want to fit a line to your x,y points and then solve the fitted line for y is zero and x is zero, giving you the x- and y-in...

presque 12 ans il y a | 1

Réponse apportée
How do I use the results of the polyfit command for the rest of my code?
Useully you would like to use the parameters of the fit to obtained fitted values. Something along these lines, perhaps? x ...

presque 12 ans il y a | 0

Réponse apportée
Generating random number between 1 to 10
In matlab you can directly loop over a vector (no need for indexing) V = randperm(10) % example vector for x = V %...

presque 12 ans il y a | 2

Réponse apportée
convert time stamp into minutes or seconds
I assume the 3rd column represents a value. [D,T,V] = textread('MyFile.txt','%s%s%f') DT = datevec(strcat(D,'-',T),'dd.m...

presque 12 ans il y a | 0

Réponse apportée
How can I get out the row numbers in where there are numbers except for zeroes?
RowNumber = find(ColumnVector)

presque 12 ans il y a | 0

| A accepté

Réponse apportée
Fast creation of vector [0 0 1 1 2 2 3 3... n n]
n = 10 % max value k = 3 % number of repetitions V = floor((0:k*(n+1)-1)/k)

presque 12 ans il y a | 2

Réponse apportée
How can i remove this logical operator error?
One of the terms is not convertible to a logical scalar. Most likely, one or both of these terms are arrays. What does siz...

presque 12 ans il y a | 0

| A accepté

Réponse apportée
How do you transform a vector of numbers into a cell of strings?
A = [1:5].' B = arrayfun(@(x) num2str(x),A,'un',0)

presque 12 ans il y a | 2

| A accepté

Réponse apportée
How can I get "least frequent" number from a vector?
Option 1: You can copy the code from mode.m and replace the function max by the function min on line 130 (in R2014a). Edit the h...

presque 12 ans il y a | 3

| A accepté

Réponse apportée
permutation without replacement matrix
% a smaller example k = 2 ; n = 4 ; v = perms(1:k) % all permutations of values 1:k v = [zeros(size(v,1),1) v...

presque 12 ans il y a | 2

| A accepté

Réponse apportée
How to remove rows with any string from matrix
Assuming that the rows are lines of a text file: T = textread('data.txt','%s','delimiter','\n') T2 = T(~cellfun(@(x)...

presque 12 ans il y a | 0

| A accepté

Réponse apportée
How to Find Column Duplicates
X = A{1} X = X(:,3) % just column 3 [a,i,j] = unique(X) % find all unique elements n = histc(j,1:numel(a)) % ...

presque 12 ans il y a | 1

| A accepté

Réponse apportée
Extract numbers between two underscores.
str = 'Color_84_2014-01-31-16-49-31-702.jpg' num = sscanf(str,'Color_%d') If your strings are stored in a cell array of...

presque 12 ans il y a | 1

Réponse apportée
read data from variables with names matching patterns
X = load('StudentsMatfile.mat') ; LABELS = fieldnames(X) ; N = numel(LABELS) DATA = cell(N,1) for k=1:N DATA...

presque 12 ans il y a | 1

Réponse apportée
How do I determine the number of headerlines in a text document?
Read the file as strings and parse the strings. The following might work (at least it works when I copied your example into a fi...

presque 12 ans il y a | 3

Réponse apportée
Store columns in a matrix in different variables
Why do you want to do this? It is much easier to deal with a specific column using indexing A(:,13) then using variable names li...

presque 12 ans il y a | 0

Réponse apportée
How to make a linear regression line?
The function <http://www.mathworks.nl/help/stats/lsline.html LSLINE> will add a linear regression line to a plot.

presque 12 ans il y a | 0

Charger plus