Beantwortet
find the 3 maximum elements and their index
r = rand(100,1); [val ind] = sort(r,'descend'); val(1:3) ind(1:3) r(ind(1:3))

fast 14 Jahre vor | 3

Beantwortet
"real positive integers or logicals" error
do you have a variable named cos? whos cos If you do, you will want to clear it out. clear cos

fast 14 Jahre vor | 2

| akzeptiert

Beantwortet
Using Variable Contents to Create Variable names
eval([MyPG{i} '_' RtnType{x} '= [' MyPG{i} '_' RtnType{x} ',' num2str(MyMedian) '];'])

fast 14 Jahre vor | 0

| akzeptiert

Beantwortet
norm square
Have you tried CRE = norm(P)^2; help norm doc norm

fast 14 Jahre vor | 1

Beantwortet
computes days of the week
help weekday doc weekday

fast 14 Jahre vor | 0

Gelöst


Make one big string out of two smaller strings
If you have two small strings, like 'a' and 'b', return them put together like 'ab'. 'a' and 'b' => 'ab' For extra ...

etwa 14 Jahre vor

Gelöst


The Hitchhiker's Guide to MATLAB
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

etwa 14 Jahre vor

Gelöst


Omit columns averages from a matrix
Omit columns averages from a matrix. For example: A = 16 2 3 13 5 11 10 8 9 7 ...

etwa 14 Jahre vor

Gelöst


Project Euler: Problem 1, Multiples of 3 and 5
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23...

etwa 14 Jahre vor

Gelöst


Sorted highest to lowest?
Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

etwa 14 Jahre vor

Gelöst


Factorize THIS, buddy
List the prime factors for the input number, in decreasing order. List each factor only once, even if the factorization includes...

etwa 14 Jahre vor

Gelöst


Is my wife right? Now with even more wrong husband
Again, as in "Is my wife right?" ( <http://www.mathworks.com/matlabcentral/cody/problems/149-is-my-wife-right> ), answer 'yes' r...

etwa 14 Jahre vor

Beantwortet
Please Speed UP This Algoritm!!!
B4 = reshape(permute(bsxfun(@tims,IN4,aaa),[3 1 2]),size(aaa,3),[]); B = sum(abs(B4).^2,2);

etwa 14 Jahre vor | 0

| akzeptiert

Beantwortet
Matlab while loop/array help.
Mary, there is no need for a while loop. You can do this simply by excluding the value you and, and then taking the min. ex...

etwa 14 Jahre vor | 0

| akzeptiert

Beantwortet
Unrepeated random numbers
L = length(S); k = 5; ind = randperm(L,k); S_rand = S(ind);

etwa 14 Jahre vor | 0

Beantwortet
Color scaling
What you'll want to do is make sure you use a constant color axis. This can be set by using the command caxis. help caxis...

etwa 14 Jahre vor | 0

Gelöst


Sum all integers from 1 to 2^n
Given the number x, y must be the summation of all integers from 1 to 2^x. For instance if x=2 then y must be 1+2+3+4=10.

etwa 14 Jahre vor

Gelöst


Roll the Dice!
*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

etwa 14 Jahre vor

Beantwortet
Plot 3D line object with alpha gradient
amap = linspace(1,0,size(p,1))'; set(mfig,'FaceColor','none','EdgeColor','flat',... 'LineWidth',3,'FaceVertexAlphaDat...

etwa 14 Jahre vor | 0

| akzeptiert

Beantwortet
Geometric diagonal of a non-squared matrix
Ersilia, Assuming your image is a 2D matrix, you could take "the rectangular main diagonal" from it by using the following co...

etwa 14 Jahre vor | 0

Gelöst


The Goldbach Conjecture
The <http://en.wikipedia.org/wiki/Goldbach's_conjecture Goldbach conjecture> asserts that every even integer greater than 2 can ...

etwa 14 Jahre vor

Gelöst


Sort a list of complex numbers based on far they are from the origin.
Given a list of complex numbers z, return a list zSorted such that the numbers that are farthest from the origin (0+0i) appear f...

etwa 14 Jahre vor

Gelöst


All capital?
Are all the letters in the input string capital letters? Examples: 'MNOP' -> 1 'MN0P' -> 0

etwa 14 Jahre vor

Gelöst


Remove the vowels
Remove all the vowels in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill' Output s2 is 'Jck nd Jll wn...

etwa 14 Jahre vor

Gelöst


Distance walked 1D
Suppose you go from position 7 to 10 to 6 to 4. Then you have walked 9 units of distance, since 7 to 10 is 3 units, 10 to 6 is 4...

etwa 14 Jahre vor

Gelöst


Pizza!
Given a circular pizza with radius _z_ and thickness _a_, return the pizza's volume. [ _z_ is first input argument.] Non-scor...

etwa 14 Jahre vor

Gelöst


Given an unsigned integer x, find the largest y by rearranging the bits in x
Given an unsigned integer x, find the largest y by rearranging the bits in x. Example: Input x = 10 Output y is 12 ...

etwa 14 Jahre vor

Gelöst


How to find the position of an element in a vector without using the find function
Write a function posX=findPosition(x,y) where x is a vector and y is the number that you are searching for. Examples: fin...

etwa 14 Jahre vor

Gelöst


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

etwa 14 Jahre vor

Gelöst


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

etwa 14 Jahre vor

Mehr laden