Respondida
i want to mark the highest point of any non-black pixel within the image to find the max point.
row=find(sum(BWImage,2)==0,1,'last')+1; col=find(BWImage(row,:)~=0); row=row*ones(size(col)); Points=...

más de 10 años hace | 1

| aceptada

Respondida
How to repeat a row by a certain factor
% Creating sample data A=[2 2 2; 3 3 3; 4 4 4]; nRep=[2,1,3]; % Constructing A_New as instructed. A_new=c...

más de 10 años hace | 0

| aceptada

Respondida
How to use a char variable name as a numeric variable
Similar question has been asked. Try the answers on this post: http://www.mathworks.com/matlabcentral/answers/213097-havin...

más de 10 años hace | 0

| aceptada

Respondida
How do I get the least used character in the text file ?
%Sample text; equivalent to your a txt='this is a sample text.'; uniqueChars=unique(txt(isletter(txt))); ...

más de 10 años hace | 0

| aceptada

Respondida
Calculating the averages of different groups of values
x=[3 3 3 4 4 5 5 5 5 3 11]; y=[1 2 4 5 7 1 1 8 10 10 1]; groupBounds=[0; find(diff([x(:); NaN])~=0)]; groupAverage=a...

más de 10 años hace | 1

| aceptada

Respondida
Indexing polynomials using 'for' loop
%% Solution 1: (not recommended) p1 = [0 2 0 -2 6 -1]; p2 = [1 3 0 -2 0 0]; p3 = [0 0 3 1 0 -10]; p4 = [0 0 0 -4 1...

más de 10 años hace | 1

| aceptada

Resuelto


Triangle Numbers
Triangle numbers are the sums of successive integers. So 6 is a triangle number because 6 = 1 + 2 + 3 which can be displa...

más de 10 años hace

Resuelto


Find the sum of all the numbers of the input vector
Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

más de 10 años hace

Resuelto


Determine if input is odd
Given the input n, return true if n is odd or false if n is even.

más de 10 años hace

Resuelto


Times 2 - START HERE
Try out this test problem first. Given the variable x as your input, multiply it by two and put the result in y. Examples:...

más de 10 años hace

Resuelto


Is my wife right?
Regardless of input, output the string 'yes'.

más de 10 años hace

Respondida
How to evaluate a derivative of a function at a point?
because subs replaces x with one. Doesn't evaluate. So diff( cos(x) -x ) returns -sin(x) -1 and then you replace x with one and...

más de 10 años hace | 7

| aceptada

Respondida
fsolve to find circle intersections
% Center of the circles C1=[0,0]; C2=[5,0]; % Radius of the circles R1=3; R2=5; % x1(x,y) on the...

más de 10 años hace | 0

| aceptada

Respondida
How to generate two subsets randomly from a matrix without repetition?
So we have matrix A with 10 elements. We want to randomly divide it into two *non-overlapping* subset, one with 4 elements anoth...

más de 10 años hace | 2

| aceptada

Respondida
Can I write a Genetic algorithm code for multiple choice questions?
use MATLAB's <http://www.mathworks.com/help/gads/ga.html GA()> command. Since you have four choices, then you are pretty much i...

más de 10 años hace | 0

| aceptada

Respondida
Sum of duplicate dates in an array
I would use <http://www.mathworks.com/help/stats/grpstats.html grpstat()> as follow: if you just want to sum by the group her...

más de 10 años hace | 0

| aceptada

Respondida
Find the rows in matrix B that contain the two numbers in each row of matrix A, in every possible order
have you considered parallel processing? You could start MATLAB parallel workers using: parpool % if you don't it would ...

más de 10 años hace | 2

| aceptada

Respondida
how can I use my function on 3*3 blocks?
inputData=zeros(10,10); inputData(randi(100,[15,1]))=1 inputData = 0 0 0 0 0 0 0 ...

más de 10 años hace | 0

| aceptada

Respondida
replace number by string
Well, a quick solution would be: valueCell={ 23,23,23, ... 9997,9997,9997,9997,9997,9997,9997, ... ...

más de 10 años hace | 0

| aceptada

Respondida
Choosing the best parameters for strategy with genetic algorithm
Let's say you have successfully coded strategy function which provided seven input parameters, it would give you the 'Sharpe Rat...

más de 10 años hace | 0

| aceptada

Respondida
how to select data based on month
Here is what you should do: I have assumed that you store those two columns in a csv file as follow: % reading t...

más de 10 años hace | 2

| aceptada

Respondida
Surface plot based on cell center values
Data=rand(10,10); imagesc(s); check <http://www.mathworks.com/help/matlab/ref/imagesc.html imagesc()> for detail des...

más de 10 años hace | 1

| aceptada

Respondida
Table "Vertical Lookup", how to do it?
Look up <http://www.mathworks.com/help/matlab/ref/join.html join()> and <http://www.mathworks.com/help/matlab/ref/outerjoin.html...

más de 10 años hace | 0

| aceptada

Respondida
GA in Matlab 2014???
Since you have discrete values for x1 to x5 you need to define it as an integer problem. (I know x1,x2,x3 are not integer input ...

más de 10 años hace | 0

| aceptada

Respondida
merge two tables in matlab
% Creating Table1 T1=table(['A';'B';'C'],[2;5;6],[3;7;8],[4;8;6],'VariableNames',{'SampleName','P1','P2','P3'}) T1 = ...

más de 10 años hace | 2

| aceptada

Respondida
Insert rows from one matrix into another
use <http://www.mathworks.com/help/matlab/ref/sortrows.html sortrows()> command as follows: A = [2373 259 18.10 23.80 0.20...

más de 10 años hace | 0

| aceptada

Respondida
how to create 1*101 of some integer array?
Yo have: A = zeros(1,101); and then later you have cumtrapz(x,-4*A); all elements of *A* are zero so *-4*A* is ...

más de 10 años hace | 0

| aceptada

Respondida
How to assign a particular value to each element of a structure array for a particular field?
n=3; %initilizing some test structure s=struct('f',cell(n,1)); % generate r vector r=mat2cell(rand(1,n...

más de 10 años hace | 0

| aceptada

Respondida
How do I access structrure fields from input parser optional inputs
That's not how *varargin* works if you have function ptest(s1,varargin) .... end then once you call it as: ...

más de 10 años hace | 0

| aceptada

Respondida
My matlab code is giving me this error "Too many outputs requested". If someone can help me solve this?
Don't know why *cloud = cloudiness{matchrow, 2};* is causing too many output request error. Are you sure the error is for that l...

más de 10 años hace | 0

| aceptada

Cargar más