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

13 years ago | 0

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

13 years ago | 0

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

13 years ago | 2

| accepted

Answered
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' ;...

13 years ago | 0

| accepted

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

13 years ago | 1

| accepted

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

13 years ago | 0

| accepted

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

13 years ago | 0

| accepted

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

13 years ago | 0

| accepted

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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]

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

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

13 years ago | 1

| accepted

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

13 years ago | 0

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

Solved


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

13 years ago

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

13 years ago | 0

| accepted

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

13 years ago | 0

| accepted

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

13 years ago | 0

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

13 years ago | 1

| accepted

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

13 years ago | 0

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

13 years ago | 0

Solved


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

13 years ago

Load more