Beantwortet
Functions on subsets of vector
If the answer to my comment above is that |t| doesn't matter, an answer to your question could be: sc = accumarray(g, w.^2) ...

mehr als 13 Jahre vor | 0

Beantwortet
Why am I getting "Too many output arguments"?
Actually |row_sums| doesn't work as it outputs nothing. However, you have the impression that it works because it *displays* the...

mehr als 13 Jahre vor | 0

Beantwortet
How do I vectorize this code?
isOne = enshare1{i,j} == 1 ; enshare1{i,j}(:) = cover1(i,j,k)-1 ; enshare1{i,j}(isOne) = cover1(i,j,k) ; and same for co...

mehr als 13 Jahre vor | 2

| akzeptiert

Beantwortet
Taking data received from serial port as single element
You don't want to use CHAR, but SSCANF or STR2NUM, to convert your char |input1| into a numeric variable. >> input1 = '12' ;...

mehr als 13 Jahre vor | 0

| akzeptiert

Beantwortet
Is there a better to multiply matrices with is pattern?
Just C = A * reshape(B, 2, []) ; will produce a |2x50 C| matrix whose columns are the 50 solutions.

mehr als 13 Jahre vor | 1

| akzeptiert

Beantwortet
Appending Int to an Array Matlab
Your stations are probably incorrect.. the following works: >>requestInfoSeptaLive = 'http://www3.septa.org/hackathon/NextTo...

mehr als 13 Jahre vor | 0

| akzeptiert

Beantwortet
Translating vector into locations in a matrix
If you need to generate random indices that can appear multiple times, you'll be interested in RANDI. Ex.: >> randi(10, 1, 1...

mehr als 13 Jahre vor | 0

| akzeptiert

Beantwortet
how to count for whitespace symbol occurrences in a .txt file?
Alternatively, you can use a simple regexp. It will certainly not be the most efficient solution though for this simple task: ...

mehr als 13 Jahre vor | 0

| akzeptiert

Gelöst


Pattern matching
Given a matrix, m-by-n, find all the rows that have the same "increase, decrease, or stay same" pattern going across the columns...

mehr als 13 Jahre vor

Gelöst


Which values occur exactly three times?
Return a list of all values (sorted smallest to largest) that appear exactly three times in the input vector x. So if x = [1 2...

mehr als 13 Jahre vor

Gelöst


Reverse the vector
Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

mehr als 13 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...

mehr als 13 Jahre vor

Gelöst


It dseon't mettar waht oedrr the lrettes in a wrod are.
An internet meme from 2003 (read more <http://www.snopes.com/language/apocryph/cambridge.asp here>) asserted that readers are re...

mehr als 13 Jahre vor

Gelöst


Quote Doubler
Given a string s1, find all occurrences of the single quote character and replace them with two occurrences of the single quote ...

mehr als 13 Jahre vor

Gelöst


Program an exclusive OR operation with logical operators
Program an exclusive or operation *without* using the MATLAB function xor. Use logical operators like |, &, ~, ... instead. ...

mehr als 13 Jahre vor

Gelöst


Extract leading non-zero digit
<http://en.wikipedia.org/wiki/Benford%27s_law Benford's Law> states that the distribution of leading digits is not random. This...

mehr als 13 Jahre vor

Beantwortet
Alternative to using EVAL
If the name of your function must really be a string, you'll want to use STR2FUNC to build a function handle out of the string, ...

mehr als 13 Jahre vor | 1

| akzeptiert

Beantwortet
mathlab, don't want debug this programme
You must have your function in an M-file called |derivative.m| without the call to ODE45, and make the latter from the command w...

mehr als 13 Jahre vor | 0

Gelöst


Trimming Spaces
Given a string, remove all leading and trailing spaces (where space is defined as ASCII 32). Input a = ' singular value deco...

mehr als 13 Jahre vor

Gelöst


Find the alphabetic word product
If the input string s is a word like 'hello', then the output word product p is a number based on the correspondence a=1, b=2, ....

mehr als 13 Jahre vor

Gelöst


Sums with Excluded Digits
Add all the integers from 1 to n in which the digit m does not appear. m will always be a single digit integer from 0 to 9. no...

mehr als 13 Jahre vor

Gelöst


Arrange Vector in descending order
If x=[0,3,4,2,1] then y=[4,3,2,1,0]

mehr als 13 Jahre vor

Gelöst


Given a window, how many subsets of a vector sum positive
Given a vector: [1 0 -1 3 2 -3 1] and a window of 2, A sliding window would find: 1 + 0 = 1 0 - 1 = -1 ...

mehr als 13 Jahre vor

Beantwortet
Index exceeds matrix dimensions
When your hex code is below |0x80|, the length of the string that you get with DEC2BIN is smaller than 8 chars. Try with that...

mehr als 13 Jahre vor | 0

| akzeptiert

Beantwortet
Check Parity of a uint32 Without Converting to a Binary String?
<http://www.mathworks.com/matlabcentral/fileexchange/21025-count-on-off-or-calculate-simple-parity-bits-of-input> But if I ha...

mehr als 13 Jahre vor | 0

| akzeptiert

Beantwortet
Import data with textscan that is non-periodic
Just for the merge, without talking about improving the overall approach, you can do X = [data{2:3:3*N-1}] ; Y = [data{3:3...

mehr als 13 Jahre vor | 0

Beantwortet
Estimation the system (A) for known input and output [Y = A * X]
Unless your are in a special situation, there is an infinity of suitable A's .. and there is a dimension mismatch in your statem...

mehr als 13 Jahre vor | 1

| akzeptiert

Beantwortet
how to replace characters into digits
If you need to process long sequences, you might want to optimize a little the efficiency.. a MEX-based solution would be most e...

mehr als 13 Jahre vor | 0

Beantwortet
How can I read data from the middle of text file?
If your file had multiple lines like [FROM 192.168.7.2:658161] 058 032 055 003 056 S 070 ... 056 [FROM 192.168.7.2:65816...

mehr als 13 Jahre vor | 0

Gelöst


Stuff the Board
You have a stack of tiles to put onto an array-like playing board. Each tile has a number (always an integer), and the board var...

mehr als 13 Jahre vor

Mehr laden