Answered
How do I get all the outputs of the ind2sub function ?
You can preallocate a cell array to the same size as the |siz| input, and use this to collect all of the outputs. This will expa...

11 years ago | 2

| accepted

Answered
How i can map data axis (x,y) ->(10x10) area to a large (100x100) area?
You don't need to change your data, just change the axes limits to zoom into the data that you want to see. Try something like t...

11 years ago | 0

Answered
how do I open files automatically in certain order?(numbers giving me trouble)
You can download my FEX submission natsortfiles to sort the files into the order you want: S = dir(...); S = natsortfiles(S,'\...

11 years ago | 1

| accepted

Answered
using regexp for space delimited strings in text file.
Try this: % textscan options: opt = {'MultipleDelimsAsOne',true,'CollectOutput',true}; % required arrays: str = 'X...

11 years ago | 1

| accepted

Answered
Plotting powered matrices vs ezplot
>> x=[-5:0.01:5]; >> y=-x./(2*(x.^2).^(5/2)); >> plot(x,y) >> ylim([-10,10]) The function is discontinuous at x==0...

11 years ago | 1

| accepted

Answered
How do i make up a word by attaching several words in Matlab?
Easiest Solution: Use dir According to your other question on this topic you are reading files in a folder. Then the easiest wa...

11 years ago | 0

| accepted

Answered
to sort a matrix
Use <http://www.mathworks.com/help/matlab/ref/sortrows.html |sortrows|> with its optional second argument to select the second c...

11 years ago | 0

| accepted

Answered
extracting repeated strings line from text file
fid = fopen('data.txt','rt'); str = fscanf(fid,'%c',Inf); fclose(fid); C = regexp(str,'^PG01( +\S+)+\s+$','lineanchor...

11 years ago | 0

| accepted

Answered
I can't use the output from my function
Change the function definition to specify |sn| as an output: function sn = Fib(n) The line you wrote sn(n) does ...

11 years ago | 1

| accepted

Answered
fzero use with offset
>> fun = @(x) x^2; >> ofs = 3; >> z = fzero(@(x)fun(x)-ofs,1) z = 1.7321 and confirm that the function value is (...

11 years ago | 0

| accepted

Answered
[qrs_amp_raw,qrs_i_raw,delay,fil_ecg]=pan_tompkin(val(1,:),fs,1);
The code val(1,:) returns the entire first row of the array |val|, using very basic <http://www.mathworks.com/help/matla...

11 years ago | 0

Answered
Trying to create a vector in steps of 0.5
<http://www.mathworks.com/help/matlab/math/matrix-indexing.html MATLAB indices> start at one, and must be whole numbers (i.e. no...

11 years ago | 3

| accepted

Answered
How can I extract a certain 'cluster' of elements according to a particular condition on the elements?
Assuming that the input matrix is always square and symmetric: >> D = [1,0.8,0.9,0.5;0.8,1,0.6,0.1;0.9,0.6,1,0.7;0.5,0.1,0....

11 years ago | 0

Answered
Regexp dynamically naming tokens issue
It _might_ be possible to solve this using dynamic regular expressions, but I think in the interest of code clarity it would be ...

11 years ago | 0

| accepted

Answered
How do i create a (n x n) matrix using algorithm or other way whose elements are either -1, +3, –3 & 1 , otherwise 0, such that a11=a22=a33=.....=-1, a12=a23=a34=.....= 3, a13=a24=a35=.......= -3, a14=a25=a36=....= 1,.
You can use <http://www.mathworks.com/help/matlab/ref/toeplitz.html |toeplitz|>: >> N = 6; >> toeplitz([-1,zeros(1,N-1)]...

11 years ago | 1

| accepted

Answered
Comparing columns of two sparse matrices
*Solution One: Simple* Here is a simple solution using |ndgrid| and |arrayfun| (but slow): >> A = [1,1,0,0; 1,0,1,0] ...

11 years ago | 0

| accepted

Answered
how to output inputname from varargin
With so many variables it would be a good idea to store them in a structure anyway, to avoid workspace clutter and to make passi...

11 years ago | 0

Answered
Classify numbers in a vector
Here is a simple solution in just two lines: >> A = [1 2 3 4 5 9 10 13 15 17 18 19 21 22 24 25]; >> idx = find([true,1~...

11 years ago | 0

| accepted

Answered
Removing a bunch of elements from a 1-D vector?
Use basic <http://www.mathworks.com/company/newsletters/articles/matrix-indexing-in-matlab.html matrix indexing> to select the e...

11 years ago | 0

| accepted

Answered
How can I find index and matched value in vector
>> Vector(row,col) ans = -0.33150 Or if you do not need the index then you can use logical indexing: >> Vector(abs(...

11 years ago | 0

| accepted

Answered
how can i read the 180 images in exact sequence 1,2,3...180 similar to it is stored in database??.i already rename all the images by 1,2,3..180. in database.
You can use my FEX submission <http://www.mathworks.com/matlabcentral/fileexchange/47434-natural-order-filename-sort |natsortfil...

11 years ago | 0

Answered
how to tell Matlab smart indent not to move my comments around?
This is the simplest solution, guaranteed to work always, no custom settings required: x = 1; % this is comment % ...

11 years ago | 2

Answered
Eliminating element if a vector
Here is a simple method that you can apply to the entire matrix, without any loops: thr = 6; mat = randi(9,5) % id...

11 years ago | 1

| accepted

Answered
How can I plot a combined of attached photos (triangular domain)?
You could try plotting both of them on the same axes: funZY = @(d) meshgrid(0:d:0.8660254, -0.5:d:0.5); funS = @(z,y) (0...

11 years ago | 1

| accepted

Answered
I have made different functions as separate .m files and i want to include or call all these functions or .m files in my main .m file please any help?
Make sure that: * the Mfiles are on your <http://www.mathworks.com/help/matlab/matlab_env/what-is-the-matlab-search-path.html...

11 years ago | 0

| accepted

Answered
Using hist3 and sorting
The trick is to get the indices from the histogram, but unfortunately <http://www.mathworks.com/help/stats/hist3.html |hist3|> d...

11 years ago | 1

| accepted

Answered
how to find cell array elements in other arrays
source = {'a','b','c','d','e','f'}; bb = {'a','e','g', 'l', 'f', 'h'}; cc = {'e','c','j', 'k', 'l','aa'}; dd = {'...

11 years ago | 1

| accepted

Answered
Apply a conditon for each row apart in a matrix
F=[0 0.6250 1; 0.7 0 1; 0.5833 1 0]; r=0.5278; % rotate the matrix: G = F.'; C = size(G,1); % identify all valu...

11 years ago | 1

| accepted

Answered
How to make a matrix that descends with each row, but all columns are the same?
A simple <http://www.mathworks.com/help/matlab/ref/mtimes.html matrix multiplication> does the trick, no need for slow |repmat|:...

11 years ago | 1

Answered
How to convert image on a matrix
Like most programs MATLAB does not look _everywhere on your computer_ for files, only in specific locations. This means that the...

11 years ago | 0

| accepted

Load more