Answered
convert time from sample to second
te=0.001 xt=get(gca,'xtick') set(gca,'xticklabel',arrayfun(@num2str,xt*te,'un',0))

12 years ago | 1

Answered
How to find the common values of ith row and the rest of the rows in a matrix?
A = [1 5 6 7 8 9 ; 2 4 5 3 6 11; 3 4 1 12 11 6; 4 5 6 12 13 14]; n=size(A,1); m=1:n; for k=1:n p=setdiff(m,k); M=...

12 years ago | 0

| accepted

Answered
Inverting each Submatrix of a Matrix
If you have the image processing toolbox im=randi(10,4) out=blockproc(im,[2 2],@(x) inv(x.data))

12 years ago | 0

Answered
Assign Ranking in Matlab
v={'MJ' 65 0 'MJ' 321 0.0125 'MJ' 2 0.0125 'MJ' 1987 0.0125 'MJ' 87 0.02 'MJ'...

12 years ago | 1

| accepted

Answered
saving user's search path
You can use <http://www.mathworks.com/help/matlab/ref/uigetfile.html uigetfile> or <http://www.mathworks.com/help/matlab/ref/ui...

12 years ago | 0

Answered
How to open series of files in a loop
for k=50:50:1000 folder=sprintf('%dum',k) file=fullfile(folder,'parameter.mat') data{k}=load(file) end To...

12 years ago | 0

| accepted

Answered
Get new variable if a cell in a column changes - Matlab
firm={'ABC' 0,5 46 19970224 'ABC' 0,6 29 19970424 'EFD' 0,5 145 19970218 'EFD' 0,5 36 19970206 'GHI' 0,7 9 19971023 'LMN'...

12 years ago | 2

| accepted

Answered
Random split of a vector of unequal lengths
k=4 v=1:200 m=numel(v); idx=unique([randperm(m-2,k)+1 m]); idx0=[1 idx(1:end-1)+1]; out=arrayfun(@(ii,jj) v(ii:jj),idx0,i...

12 years ago | 1

| accepted

Answered
How to remove rows with any string from matrix
fid = fopen('file.txt'); res={}; while ~feof(fid) res{end+1,1} =fgetl(fid); end fclose(fid); res(cellfun(@(x) any(isle...

12 years ago | 0

Answered
How can I extract not zero numbers from a matrix?
M=[0 1 2 5 2 3 0 0 0 0 4 3 2 5 0 0 0 4 3 2 ]; idx=[0 M~=0 0]; ii1=strfind(idx,[0 1]); ii2=strfind(idx,[1 0])-1; out=arrayf...

12 years ago | 0

| accepted

Answered
How can I detect number that does not follow an increasing order?
s=[153 158 161 163 172 123 179 181 4 5 190] while any(diff(s)<0) ii=[1==0 diff(s)<0] s(ii)=[]; end

12 years ago | 0

| accepted

Answered
How to exclude some files while load a set of files using a loop?
for k=setdiff(1:10,[5 7])

12 years ago | 2

| accepted

Answered
Pass variables from double to cell
What you can do is ABC={B C D E F G} unless your variables have the same number of rows

12 years ago | 1

| accepted

Answered
Which is better to use in my case -uigetfile or uigetdir?
f='C:\Archive\project_dir\project_folder\' [file,pat]=uigetfile(f,'*.mat') yourfile=fullfile(pat,file) test=isequal(f,pat) ...

12 years ago | 0

| accepted

Answered
find column from list then save cell
A = {'One','Four','Five'}; B = {'One','Two','Three','Four','Five';1 2 3 4 5;6 7 8 9 10}; If you work with tables BB=...

12 years ago | 0

Answered
How to convert a cell array to a structure matrix?
col_names = {'Lp max '; 'G max'; 'G min'} v=cell2struct(col_names,'names',numel(col_names))

12 years ago | 0

Answered
how can i implement a sine function with an expression as its argument in simulink?
Combine the <http://www.mathworks.com/help/simulink/slref/trigonometricfunction.html Trigonometric function> block and the <http...

12 years ago | 1

| accepted

Answered
How can I shift rows and columns, and also replicating Sub matrixes.
A=reshape(1:16,4,4) , % First example A=circshift(A,[1 0]) % Shift down by 1 A=circshift(A,[0 -2]) % Shift left by 2 B...

12 years ago | 1

Answered
Help writing a simple function
Read the documentation, you will find examples <http://www.mathworks.com/help/matlab/ref/if.html if, elseif, else>

12 years ago | 0

Answered
Error unexpected matlab operator
This looks like Mupad code, You have to look at Mupad help doc mupad If you are new with matlab, then begin with Matlab ...

12 years ago | 0

Answered
how to read and display multiple images from folder?
folder='C:\Users\Vaio\Desktop\new' I=dir(fullfile(folder,'*.jpg')); for k=1:numel(I) filename=fullfile(folder,I(k).na...

12 years ago | 2

| accepted

Answered
Convert cell-array to array-of-cells, for array-of-struct creation?
To=num2cell([Fr{:}])

12 years ago | 0

Answered
the if statement with and/or
if a<100&b<100&c<100&d<100 %do end %or if all([a b c d]<100)

12 years ago | 0

| accepted

Answered
Store columns in a matrix in different variables
st=num2cell(A,1) You can access each column by st{1} st{2}

12 years ago | 2

| accepted

Answered
Convert space separated string table to cell?
Table = ['A2 6C 33 04 00 81 00 80';'3F 11 65 01 0A '] [n,m]=size(Table) Table(:,3:3:end)='/'; ss=regexp(num2cell(Ta...

12 years ago | 1

Answered
How to count the number of occurances of a specifc sample?
x= {'Jan.1', 'Jan.1', 'Jan.1', 'Jan.2', 'Jan.2', 'Jan.3' 'Jan.3'} y= [ 1 0 1 1 1 0 1 ] z=x(logical(y)) [aa,bb,...

12 years ago | 0

Answered
Convert space separated string table to cell?
Table = ['A2 6C 33 04 00 81 00 80';'3F 11 65 01 0A '] Table(:,3:3:end)=[]; [n,m]=size(Table); [bb,aa]=meshgrid(1:2:...

12 years ago | 2

Answered
Save image for each iteration
for k=1:3 % your code FileName=sprintf('fig%d.jpg',k) saveas(gcf,FileName) end

12 years ago | 0

| accepted

Answered
How to pass data from .m file to GUI ?
Use <http://www.mathworks.com/help/matlab/ref/guidata.html guidata> function

12 years ago | 0

Load more