Answered
Counting subrows in each row of a matrix?
I think you need to use at least one loop A=[1 1 1 0 1 1 0 0 0 1; 1 0 1 1 1 1 0 0 1 1] for k=1:size(A,1) a=[0 A(k,:...

12 years ago | 0

Answered
how to average a three dimensional matrix at each level?
a=rand(40,40,16) % Example out=squeeze(mean(mean(a)))

12 years ago | 0

| accepted

Answered
How to loop CSVwrite
for i=1:10 filename = sprintf('Pressure%d.csv',i); csvwrite(filename,P) end

12 years ago | 3

| accepted

Answered
Find value in a cell array if you have its index
You can use C1=cellfun(@(x,ii) x(ii),A,num2cell(B))'; But your for loop is faster, do not forget the pre-allocation ...

12 years ago | 0

Answered
Get rid of an unwanted zero element in an IF loop
x = [1 2 5 2 2 7 8 3 3 1 3 8 8 8] [freq,a]=hist(x,unique(x)) out=a(freq==3)

12 years ago | 0

| accepted

Answered
How to get random image from specific folder in matlab ?
d='Yourfolder'; f=dir([d '\*.jpg']); n=numel(f); idx=randi(n); im=imread(f(idx).name); imshow(im)

12 years ago | 1

| accepted

Answered
How to delete column and char from text file
fid = fopen('file.txt'); a = textscan(fid, '%s %f %s','headerlines',3); fclose(fid); data=a{2}

12 years ago | 0

| accepted

Answered
Non-scalars are not supported in IF or WHILE statements
linebb is a vector, what do you want to test? for example if linebb=[1 2 3] your are trying to compare linebb to 2, ...

12 years ago | 0

| accepted

Answered
i want to store the values entered in uitable (gui)....so as to use it in future .......
If You want to use it after another execution of your gui file, store it in a mat file save yourfile yourmatrix If you...

12 years ago | 0

Answered
how to subtract 2 cell array??
a={1 2 3} b={10 20 30} c=cellfun(@(x,y) x-y,a,b)

12 years ago | 0

Answered
how to divide an image into 3*3 block?for each block i have to calculate mean and standard deviation for each block
You can use blockproc im=imread('your_image') [n,m]=size(im) n1=ceil(n/3) m1=ceil(m/3) im_mean=blockproc(im,[n1,m1],@(x...

12 years ago | 0

Answered
how to define h(t)=1/2, 0<t<2*pi, interval=0.5
t=0:0.5:2*pi h=0.5*ones(1,numel(t))

12 years ago | 0

| accepted

Answered
save table as space delimted text file, not tab delimited
Add one space or more after |%.0f| fprintf(fid,'%.0f ',table(ii,:))

12 years ago | 0

| accepted

Answered
Select first max value of each cell at a cell array.
a={[2 4 2 3 4] [0 2 6 4 0 6 1]} n=numel(a); maxval=zeros(1,n); idx=zeros(1,n); for k=1:numel(a) [ii,jj]=max(a{k}) ...

12 years ago | 0

| accepted

Answered
insert mp3 file in matlab
You can use audioread function [y,fs]=audioread('yourfile.mp3') To play your file sound(y,fs) Look at doc ...

12 years ago | 0

| accepted

Answered
How to cut EEG signal?
If s is your signal n=numel(s); n1=fix(180*n/300); n2=fix(240*n/300); out=s(n1:n2)

12 years ago | 1

Answered
Combine two tables together
a=[1 1;2 0;3 1]; b=[4 1;5 0;6 1]; c=[a;b] Look at the documentation <http://www.mathworks.com/help/matlab/matrices-and-ar...

12 years ago | 0

| accepted

Answered
How do I concatenate char and double classes?
%Example z =strvcat('DUE','DUE','BT','PRE_REL') data=rand(4,3) %convert your char array to cell array c=cellstr(z) %cov...

12 years ago | 1

| accepted

Answered
Create plot with orthonormal axis
Use nyquist function

12 years ago | 0

Answered
Extract part of a sparse matrix
i = [5556 68424 85345 925325]; ii=sub2ind(size(A),i,i) A_new = A(ii)

12 years ago | 0

| accepted

Answered
Using randperm to generate a shuffled cell array. How do i get the original ordered cell array
Example a={'a' 'b' 'c' 'd' 'e' 'f'} n=numel(a) ii=randperm(n) [~,previous_order]=sort(ii) b=a(ii) %to get a old...

12 years ago | 2

| accepted

Answered
Finding x-values from found y-values
ymax=findpeaks(data_1) ii1=find(data_1>ymax(1)/2,1) ii2=numel(data_1)-find(fliplr(data_1)>ymax(2)/2,1)+1 step_width=step_1(...

12 years ago | 0

Answered
extract blocks from image
[n,m,p]=size(im1) % im1 is your image n1=mod(-n,75) m1=mod(-m,75) new_im1=imresize(im1,[n+n1,m+m1]);

12 years ago | 1

| accepted

Answered
how to add and substract manually in a matrix?
A=[1 1 0.7 1 0.7 1 1 1 1 1 0.7 1] s=3-sum(A); ii=A==1; jj=sum(ii); a=s./jj; b=bsxfun(@times,ii,a); b(...

12 years ago | 1

| accepted

Answered
the code doesn't update the values
You need to initialize your variable t

12 years ago | 0

Answered
How to count how many times each element appears in a vector preserving the order?
A=[5; 5; 5; 1; 4; 4; 3; 3; 3]; [ii,jj]=unique(A); b=hist(A,ii) [i1,i1]=sort(jj); B=b(i1)'

12 years ago | 0

| accepted

Answered
Concatenation of images in one Matrix
Suppose im1 is 512x512, im2 is 256x256 and im3 is 128x128 [n,m,p]=size(im1); new_im2=imresize(im2,n,m); new_im3=imresize(...

12 years ago | 0

Answered
Option 'stable' of the command unique?
[a,idx]=unique(A) [ii,ii]=sort(idx); B=sum( bsxfun(@eq,A,a(ii)'))'

12 years ago | 0

| accepted

Answered
how to create this waveform using uniform random number in simulink block?
Use a <http://www.mathworks.com/help/simulink/slref/randomnumber.html Random Number> block

12 years ago | 0

| accepted

Answered
limit of elements in a matrix
To get information about memory, type memory look at <http://www.mathworks.com/help/matlab/matlab_prog/resolving-out-of-...

12 years ago | 0

Load more