Answered
How can an object array be extented by itself?
I find matlab's concept that an array of objects is the same type as the objects themselves very very wrong and I would avoid re...

11 years ago | 0

Answered
Comparing more than two columns of a matrix using '<' or '>' symbol
There is only ever one number per row that is smaller than all the other columns, and that is the *minimum* of the row. Hence, u...

11 years ago | 0

| accepted

Answered
How to I combine different numbers of columns from two matrices?
I would have done it with a logical array: A=repmat(1:4,3,1); % A has its column filled with number 1 to 4 B=repmat(5:16...

11 years ago | 0

Solved


longest sequence of nans
In an array return the length of longest sequence of nans for each column. x = [ 2 3 1 2 5 6; nan nan 5 n...

11 years ago

Solved


If you prick us, do we not bleed?
While doing some quick sewing to fix up your child's Halloween costume, you accidentally jab your finger with the needle. Refle...

11 years ago

Answered
how do I define an index for the subplot position from two indexes of nested for loops?
Use |sub2ind|: subplot(numel(input1), numel(input2), sub2ind([numel(input1), numel(input2)]), i, j) Note that it should ...

11 years ago | 0

| accepted

Answered
Collecting information in columns if X
I'm not sure what you mean by _gather_. In the simplest sense: dailydata = [2008 12 30 1 5; 2008 12 31 5 7;...

11 years ago | 0

Answered
Basic question on Round function
Are you supposed to create a script of a function? If a function where is the function declaration? In either case, you're no...

11 years ago | 0

Answered
Accessing matrix columns using index which are not continuous (example:index=1,5,9,13 etc)
I'm not clear on what exactly is posing you problem and not clear either on the structure of your text files, so can only give y...

11 years ago | 0

Answered
Loop through a Cell Array
Your sorting is nearly a multi-column sort (for which you'd use |sortrows|) except for your first criteria (smallest distance of...

11 years ago | 0

| accepted

Answered
goto command in matlab
There's no goto in matlab, and there is no need to. You could just as well code your algorithm as: %... step 1 to 29 con...

11 years ago | 0

| accepted

Answered
Index exceeds matrix dimensions
Well, either |data| has less than 7 columns or less than |nRows| rows. Before the |for| loop insert these two lines: as...

11 years ago | 0

| accepted

Answered
How to copy specific columns of a character array to another character array?
The way to fix your loop would be to gather the list of columns to delete inside the loop and perform the deletion after the loo...

11 years ago | 1

| accepted

Answered
Attempted to access dy(0,1); index must be a positive integer or logical.
What is not clear about the message? Matrix indices must be strictly positive integers. You're using the elements of |x| to inde...

11 years ago | 0

Answered
calling java base64 constructor with arguments
If you look at the list of methods available for that java class with methodsview org.apache.commons.codec.binary.Base64 ...

11 years ago | 2

| accepted

Answered
How to display grayscale image using imshow function
The problem is that your |f| (what a bad variable name for an image!) is not a greyscale image as greyscale is not supported by ...

11 years ago | 0

Solved


replace nan values iteratively.
replace nan values with the average of two neighbour non-nan value iteratively as follow; x = [2; 4; 6; nan; nan; nan; 10]; ...

11 years ago

Answered
Mean Square Error (MSE)
I'm assuming that the MSE you refer to is calculated according to the first formula on the <https://en.wikipedia.org/wiki/Mean_s...

11 years ago | 0

Answered
Delete elements from a vector that are less or equal than the elements immediately before them
The solution to your problem is to collect the indices to delete in the loop and perform the deletion all at once after the loop...

11 years ago | 0

| accepted

Answered
Comparing Matrices and Printing the result of the comparison
For a given row: %row: row index if any(Mat2(row, :)) %Mat2 has at least a non-zero value in the row %assump...

11 years ago | 0

Answered
Matlab reshape in 3D
I'm not sure it can be done with |reshape| and |permute| alone. Temporarilly using a cell array, it's very easy: A = permu...

11 years ago | 2

| accepted

Answered
Insert a string in a code to export a figure
Use <http://www.mathworks.com/help/matlab/ref/sprintf.html |sprintf|> or plain string concatenation to build your string: h...

11 years ago | 0

| accepted

Answered
How to find least 8 values in a 1xN row matrix with their positions?
If it's just least 8 regardless regardless of if they're equal or not, simply use |sort| and only keep the first 8 results: ...

11 years ago | 0

| accepted

Answered
How can I fit multiple column matrix in a matrix?
Either, replace the assignment in the loop by an indexed assignment: M(i, :) = [T(i) T1(i) T2(i) T3(i) T4(i) T5(i)]; %surel...

11 years ago | 0

| accepted

Answered
how could I loop value of n because dimension is mismatch?
There's something that does not make sense on nearly every line you've written: ind = (fix(linspace(1,length(he),fs))); ...

11 years ago | 0

Answered
Separate CSV to stucture array by a specified field
A table probably makes the reading of the file easier but I'm not sure it helps much after that. I don't think <http://www.mathw...

11 years ago | 0

Answered
Normalization of a matrix to a particular value
_|a = a .* sqrt(0.125)|; However, the elements corresponding to 1 are still not 0.125_. I predict that your elements corresp...

11 years ago | 0

| accepted

Answered
Extract subvectors from a vector without using loops
You can use <http://www.mathworks.com/help/matlab/ref/mat2cell.html |mat2cell|> for this but I don't know if it's going to be an...

11 years ago | 0

Answered
how do i verify input is only zeros and 1's
_"It does not seem to work"_ In what way? >>number = '1100111'; >>all(ismember(number, '01')) ans = 1 >>...

11 years ago | 0

| accepted

Answered
Combine cells of a {1,3} cell array.
v = sort([yourcellarray{:}]) Note that I've not put the result into a single cell cell array because there's not much point...

11 years ago | 1

Load more