Answered
How to set up a forloop for calculations between different cells in a cell array?
_"What is a better way to implement this?"_ You don't tell us what "this" is. If you are trying to calculate the squared differe...

10 years ago | 0

Answered
I need help with matrix problem!
>> +~eye(7) ans = 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0...

10 years ago | 1

| accepted

Answered
Setting up a counter in a RNG (Random Number Generator)
Why not just put it in a |for|-loop: for k = 1:10 rng(k) str = sprintf('rng %f',k) ... your code en...

10 years ago | 0

Answered
How do I iterate through multiple structures?
The simplest solution is to create *one* <http://www.mathworks.com/help/matlab/matlab_prog/access-multiple-elements-of-a-nonscal...

10 years ago | 0

| accepted

Answered
I need help working with invalid variable names in *.mat files with MATLAB 2015b.
Try this FEX submssion: <http://www.mathworks.com/matlabcentral/fileexchange/42274-loadfixnames-loads-a-mat-file--fixing-inva...

10 years ago | 0

Answered
why is the image blurred after rgb to hsi conversion?
Because you are inputting an HSI image. The <http://www.mathworks.com/help/images/ref/imshow.html |imshow|> documentation clearl...

10 years ago | 1

| accepted

Answered
Plotting a legend inside of a function with multiple variable names
var = {{'legstr','legstr2'},'Location','eastoutside'}; legend(var{:})

10 years ago | 0

| accepted

Answered
Error using rand Size inputs must be integers. Error in make_sct (line 53) x=x_range*(rand(1,N)-0.5);
When I run your code the value of |N| is >> N N = 15593.9233856041 clearly this is not an integer, so it cannot b...

10 years ago | 1

Answered
Minimum of unique values
You can use <http://www.mathworks.com/help/matlab/ref/unique.html |unique|> and <http://www.mathworks.com/help/matlab/ref/accuma...

10 years ago | 0

| accepted

Answered
unzip specific folder of zip file
<http://www.mathworks.com/matlabcentral/answers/10945-read-files-in-zip-file-without-unzipping> <http://www.mathworks.com/mat...

10 years ago | 1

Answered
How can I do the rolling sum of 5 elements for each column? I have a dataset like this, and would be greatful, someone can help me to write a code for rolling sum of 5 elements of each column.
Use <http://www.mathworks.com/help/matlab/ref/conv2.html |conv2|>: >> X = conv2(da,ones(5,1)) Note that there are severa...

10 years ago | 0

| accepted

Answered
How to round up and down a value close to multiple of 5?
>> V=148.559; >> 5*floor(V/5) ans = 145 >> 5*ceil(V/5) ans = 150

10 years ago | 6

| accepted

Answered
dlmread reading file incorrectly
The data you have shown does not use tab as the delimiter, but uses four space characters. You could use <http://www.mathwork...

10 years ago | 1

| accepted

Answered
Is it possible to find corresponding row from other matrix's row??
It is easy, you just need to assign the logical conditions to an index variable. So instead of this: x0(any(x0<2,2),:) = []...

10 years ago | 1

| accepted

Answered
how can i assign a variable to a column in a for loop in other to plot a graph?
You don't need the loop, just use indexing: % Fake numeric matrix of size 10x34: v = rand(10,34); v(:,1) = 1:10; %...

10 years ago | 1

| accepted

Answered
Problems with strrep: y(1)0 instead of y(10)
Instead of writing your own parser you should simply use <http://www.mathworks.com/help/matlab/ref/regexprep.html |regexprep|>: ...

10 years ago | 1

Answered
Basic indexing question Find ismember
You need to learn about the practical limits of <https://en.wikipedia.org/wiki/Floating_point floating point numbers>. Basica...

10 years ago | 0

| accepted

Answered
How to find subgroup min or max
Use <http://www.mathworks.com/help/matlab/ref/accumarray.html |accumarray|> and <http://www.mathworks.com/help/matlab/ref/bsxfun...

10 years ago | 0

| accepted

Answered
Vectorization of for loop and multidimension array
Just use <http://www.mathworks.com/help/matlab/indexing.html indexing> properly and then this is trivial: L = size(array,2)...

10 years ago | 1

| accepted

Answered
Error using ' . Transpose on ND array is not defined. Use PERMUTE instead.
You forgot that images are 3D arrays, not 2D matrices. Try this: img = imread(str); size(img) and you will find that |i...

10 years ago | 0

Answered
How can I extract multiple values after certain term with regexp?
As an alternative to |regexp|, you can simply read the file data directly using <http://www.mathworks.com/help/matlab/ref/textsc...

10 years ago | 1

Answered
how to store the score value of sequence alignment in an array on every iteration ?
You can allocate the values using <http://www.mathworks.com/help/matlab/indexing.html indexing>: score = zeros(1,10); al...

10 years ago | 0

Answered
Why don't these functions exist?
Obviously it is not possible to use functions from toolboxes that you do not have. And the online documentation makes it easy to...

10 years ago | 0

| accepted

Answered
How to put selected rows of a matrix into a cell in order defined by another matrix's elements?
Don't fight MATLAB with nested loops, this is such a slow way to code (especially without <http://www.mathworks.com/help/matlab/...

10 years ago | 1

| accepted

Answered
my y values are from 4 to 7 range with interval of 0.1...but when i plot bar3 it shows 1 to 30 range..how can i fix my axis??please see code and output grap in image attched
Either adjust the Y-axis labels yourself like this: <http://www.mathworks.com/matlabcentral/newsreader/view_thread/312160> ...

11 years ago | 0

Answered
Invert bit vector ?
>> A=[0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0]; >> B=[1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1]; >> C = [A(end-3:end),A(1:end-4)]; >> ...

11 years ago | 0

| accepted

Answered
How to get an x,y location on an image by clicking on it?
Have a look at <http://www.mathworks.com/help/matlab/ref/ginput.html |ginput|>.

11 years ago | 1

| accepted

Answered
How to change precision of variable output
Read about <http://ww.mathworks.com/help/matlab/ref/sprintf.html |sprintf|>, it gives you lots of control over how numbers are d...

11 years ago | 0

Answered
What is better option than using 'global' ?
The MATLAB documentation covers this quite comprehensively: <http://www.mathworks.com/help/matlab/matlab_prog/share-data-betw...

11 years ago | 1

Answered
ismembertol - inconsistent results compared to documentation
<http://www.mathworks.com/help/matlab/ref/ismembertol.html |ismembertol|> is not doing anything wrong. The problem is that yo...

11 years ago | 0

| accepted

Load more