Answered
Replace missing values by 0
Although the data is formatted rather sloppily, it is possible to read the whole file at once using <http://au.mathworks.com/hel...

11 years ago | 1

| accepted

Answered
How can do intersection and union of two vectors?
*Intersection*: simply use <http://www.mathworks.com/help/matlab/ref/intersect.html |intersect|> with the |stable| option: ...

11 years ago | 3

| accepted

Answered
How to delete lines in a text file?
EDIT: now the the OP has actually posted a sample data file. A very robust way to read is to use <http://www.mathworks.com/he...

11 years ago | 0

Answered
Skipping nan's for computation and starting the vector where first value appears
The function <http://www.mathworks.com/help/matlab/ref/isnan.html |isnan|> is used to identify NaN values. Even better would be ...

11 years ago | 1

Answered
How do I append data to an existing csv file using dlmwrite?
According to the <http://www.mathworks.com/help/matlab/ref/dlmwrite.html |dlmwrite|> documentation, the function does not have a...

11 years ago | 1

Answered
Matrix Expansion Row Wise Using Interpolation
Here is a complete working example of how you could use <http://www.mathworks.com/help/matlab/ref/interp1.html |interp1|> to int...

11 years ago | 0

Answered
If I have a 2100 x 16 matrix, how can I specify for a certain value to go in to rows 1:84, then another into 85:169, and repeat this 25 times in some kind of loop?
Don't bother with a loop, in MATLAB <http://www.mathworks.com/help/matlab/matlab_prog/vectorization.html vectorized code> is nea...

11 years ago | 0

| accepted

Answered
How to parameterise a function?
The standard answer is to replace each |x|, |y| and |z| with the corresponding element of the input vector: g = @(V) = V(1)...

11 years ago | 0

| accepted

Answered
how can enlarge a matrix?
If you have MATLAB R2015a (or more recent) then you can use <http://www.mathworks.com/help/matlab/ref/repelem.html |repelem|>. ...

11 years ago | 1

| accepted

Answered
please why i cant get a figure ( it give me an empty figure)
It would be much simpler to <http://www.mathworks.com/help/matlab/matlab_prog/vectorization.html vectorize the whole code> (no l...

11 years ago | 0

Answered
Pulling Even numbers from an array
Hers is a simple <http://www.mathworks.com/help/matlab/matlab_prog/vectorization.html vectorized> function: function [] =...

11 years ago | 0

Answered
How do you draw a plane on Matlab?
For a start you could have a look at this aeroplane: http://www.mathworks.com/matlabcentral/fileexchange/47967-draw-a-3d-airp...

11 years ago | 0

| accepted

Answered
Concatenate cell array with double matrix
You can use <http://www.mathworks.com/help/matlab/ref/num2str.html |num2str|> inside <http://www.mathworks.com/help/matlab/ref/a...

11 years ago | 1

| accepted

Answered
How do I "backward" a string in matlab: turn "a" into "z", "b" into "y", "c" into "x", etc.
You could use <http://www.mathworks.com/help/matlab/ref/char.html |char|>: >> char(219-'abc') ans = zyx Note this ...

11 years ago | 0

| accepted

Answered
Multiplying matrices of different sizes
It seems that you are looking for element-wise multiplication, with singleton dimension expansion... which is what <http://www.m...

11 years ago | 0

| accepted

Answered
Make matrix from input size
If you want all pairs of subscript indices, then you can use <http://www.mathworks.com/help/matlab/ref/ind2sub.html |ind2sub|>: ...

11 years ago | 0

| accepted

Answered
Adding smaller matrices into a larger matrix using a loop
Try this: V9Split = mat2cell(V9,repmat(5,20,1),5) V9_eff = zeros(20,5); for k = 1:20 V9_eff(k,:) = V...

11 years ago | 0

Answered
how to make a function that takes a matrix and integer and divide every divisible element of matrix by integer
There is no need to use slow |find|, when <http://blogs.mathworks.com/steve/2008/01/28/logical-indexing/ logical indexing> is fa...

11 years ago | 2

| accepted

Answered
Merging Multiple text files
I had exactly the same issue, and solved it by writing a function called natsortfiles to sort file-names into order based on the...

11 years ago | 0

| accepted

Answered
Simple miscalculation: (1-0.95)*4000 = 2.000000000000002e+02
This is not a bug, nor is it a mistake. This is the normal behavior of floating point numbers, and although it is not at all une...

11 years ago | 1

| accepted

Answered
when the secret text contain pair(doubke) character like 'dd',mm' ,'ll', the Y vector reswtores as Nan
I think you just need to preallocate the cell array, and then index into it inside the loop: str = 'steganography is the ar...

11 years ago | 0

| accepted

Answered
function with input a matrix and calcualte sum of elements of its diagonal and right of it
>> a = [1,2;3,4] a = 1 2 3 4 Method one: >> sum(sum(triu(a))) ans = 7 Method ...

11 years ago | 0

| accepted

Answered
how can i make a single column matrix
Although the original question does not give the basic random number specifications (particularly the number type and if repetit...

11 years ago | 0

| accepted

Answered
Minimum value in sub Matrix
You can just use <http://www.mathworks.com/help/matlab/ref/min.html |min|> with its optional dimension argument: X = [4D ar...

11 years ago | 0

| accepted

Answered
How to write _ in a plot title?
Actually there are two main ways of dealing with this. Each of them can be useful, depending on the circumstances: # Use the ...

11 years ago | 9

Answered
Haw to add new element of cell arrays?
You can use the <http://www.mathworks.com/help/matlab/ref/end.html |end|> operator: A = {'abc','xyz','123'}; A{end+1} =...

11 years ago | 1

| accepted

Answered
the rang of unit 8 is 0-255 But im2double convert the range to [0, 1] instead of [0, 255]. please anyone explain it????
This is the expected (although not clearly explained) behavior of <http://www.mathworks.com/help/matlab/ref/im2double.html |im2d...

11 years ago | 1

| accepted

Answered
Creating a table for a cell array with cell2table
I suspect that the data inside that |{1x1 cell}| is actually |NaN|, and that it is just being displayed slightly differently dep...

11 years ago | 0

| accepted

Answered
What is the shortest way to make matrix from a vector using the 1-of-K coding scheme?
This is easy using <http://www.mathworks.com/help/matlab/ref/sub2ind.html |sub2ind|>: >> C = [1,1,2,3,1,3,2]; >> R = 1:n...

11 years ago | 0

| accepted

Answered
Problem with a code
Here is a solution using no loops, and only <http://www.mathworks.com/help/matlab/matlab_prog/vectorization.html vectorized code...

11 years ago | 2

| accepted

Load more