A résolu


Determine whether a vector is monotonically increasing
Return true if the elements of the input vector increase monotonically (i.e. each element is larger than the previous). Return f...

environ 13 ans il y a

A résolu


Select every other element of a vector
Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

environ 13 ans il y a

A résolu


Who Has the Most Change?
You have a matrix for which each row is a person and the columns represent the number of quarters, nickels, dimes, and pennies t...

environ 13 ans il y a

A résolu


Most nonzero elements in row
Given the matrix a, return the index r of the row with the most nonzero elements. Assume there will always be exactly one row th...

environ 13 ans il y a

A résolu


Finding Perfect Squares
Given a vector of numbers, return true if one of the numbers is a square of one of the other numbers. Otherwise return false. E...

environ 13 ans il y a

A résolu


Make the vector [1 2 3 4 5 6 7 8 9 10]
In MATLAB, you create a vector by enclosing the elements in square brackets like so: x = [1 2 3 4] Commas are optional, s...

environ 13 ans il y a

Réponse apportée
how to count the no of words in a sentence?
txt = fileread('hello.txt'); %read in file, assuming it is not too big sentences = strtrim(regexp(txt, '[\.\?\!]+', 'split...

environ 13 ans il y a | 0

| A accepté

Réponse apportée
Find minimum difference between matrices.
Another way using histc() function (may be faster for large matrices). A = rand(5,5); %first matrix B = rand(2,3); %s...

environ 13 ans il y a | 1

Réponse apportée
How to repeat rows of matrix?
One way: f = @(k) repmat(M(k,:), round(V(k)), 1); MM = cell2mat(arrayfun(f, (1:length(V))', 'UniformOutput', false));

environ 13 ans il y a | 0

| A accepté

Réponse apportée
Size of data points in random scatter image
This is actually a relatively straightforward process. Steps: 1. Threshold image to convert to black and white. im2bw() fu...

environ 13 ans il y a | 0

| A accepté

Réponse apportée
Comparing Vector Elements (of 2 vectors)
I think this should do what you want: Rc = mat2cell(R, 1, ones(size(R))); comp = cellfun(@(x) find(P<x,1,'last'), ...

environ 13 ans il y a | 0

| A accepté

Réponse apportée
Find consecutive values in a vector that are above a threshold
One way: s = RandStream('mcg16807','Seed',0); RandStream.setDefaultStream(s); %set seed so example is reproducible m...

environ 13 ans il y a | 6

| A accepté

Réponse apportée
How to divide an arc?
If I understand your question correctly, John D'Errico's interparc ( <http://www.mathworks.com/matlabcentral/fileexchange/34874-...

environ 13 ans il y a | 1

Réponse apportée
Extract Variable from Filename?
You can use strtok() or other methods, but I prefer regexp here: filename = 'sitename.yr.synth.daily.mat' %example ...

environ 13 ans il y a | 0

| A accepté

Réponse apportée
Matlab code for system of differential equations (chemical kinetics) fitting to data
To be clear, you want to fit experimental data to a system of differential equations with some number of unknown parameters, cor...

environ 13 ans il y a | 4

Réponse apportée
I have matrix A, how can I add a row in matrix A with others rows of matrix A ?
b = sum(a(:,1:10:91),2)

environ 13 ans il y a | 2

| A accepté

Réponse apportée
thermal images processing || Need help! :)
Here's an example of an approach that might work: X= imread('coins.png'); %sample indexed image BW = (X > 100); ...

environ 13 ans il y a | 1

Réponse apportée
convert Vector into matrix ?
It might not be very efficient, but I think it should work: nc = 3; %number of columns in B nc = nc-1; c = 1:(length...

environ 13 ans il y a | 0

Réponse apportée
Improve Ellipse Fit around a Binary Image
To build on Image Analyst's point, you can do something like this. outline = bwmorph( isolatedBean, 'skel'); %convert ...

environ 13 ans il y a | 0

Réponse apportée
How to resample a signal by a fraction
You could use interpolation instead. Something like this: vnew = interp1( t, v, t/(1+a), 'linear'); You could use other ...

environ 13 ans il y a | 0

| A accepté

Réponse apportée
Filling gaps in time series with Nan
One way that considers floating point errors: startValue = datenum(2013,5,17,0,0,0); %your starting observation endVa...

environ 13 ans il y a | 1

Réponse apportée
How do I get regexp to read specific values in a text file?
This seems to work for me: pattern = 'Platform:\s+(\d+)'; data = regexp(indata, pattern, 'tokens'); data = cell2mat...

environ 13 ans il y a | 1

| A accepté

Réponse apportée
how to find indices on a boundary?
You can use the inpoly() function on the file exchange ( <http://www.mathworks.com/matlabcentral/fileexchange/10391-fast-points-...

environ 13 ans il y a | 0

Réponse apportée
I need help (palindrome vector)
y = x([1:end, end-1:-1:1])

environ 13 ans il y a | 1

Réponse apportée
Extract non-zero elements from matrix with double precision numbers
notZeros= M(M~=0); Keep in mind that due to numerical precision, some of your matrix elements may be small but not identica...

environ 13 ans il y a | 0

Réponse apportée
index of a sequence
You don't really need the loops: a=[50 150 80 200 30]; b=[60 50 150 70 200]; [d,rows]= min([a;b], [], 1); %get l...

environ 13 ans il y a | 1

| A accepté

Réponse apportée
How to a partition a data set of days into weekdays and weekends
Hi Torrey, I think this should do it: %Matrix is your 365x48 matrix %Every 4th and 5th rows are Saturday and Sunday ...

environ 13 ans il y a | 0

Réponse apportée
Script Writes Correctly, The Graph Still Doesn't Show Up
Call hold on after your silhouette() call. 'hold on' prevents the current axes from being cleared after each plotting command. ...

environ 13 ans il y a | 0

| A accepté

Réponse apportée
replacing components of a matrix
%your matrix is M isBetween = (M >= 2.9) & (M <= 3.2); M(isBetween) = -1

environ 13 ans il y a | 0

| A accepté

Réponse apportée
how to calculate the area under a plot? when I use the area option, I'm not getting a satisfactory value. someone pls help me.
This isn't what the area() function does. The area function plots a filled shape below the line that is passed into it. The grap...

environ 13 ans il y a | 0

Charger plus