Answered
code sequence repeat 1000 times
ones(1,1000)*L

12 years ago | 0

| accepted

Answered
Cutting a for loop when a certain value is repeated
It's better to use a while loop while x(k-1)~=x(k) % your code end

12 years ago | 0

Answered
How can I read in rows from an Excel spreadsheet using iteration?
filename='ht2.xls'; mat=xlsread(filename); Then use the row you want mat(k,:)

12 years ago | 0

| accepted

Answered
Working with array elements and structure
replace k by K in phi_P=(phi_p).*(k-1);

12 years ago | 0

Answered
Can you vectorize this code?
Use <http://www.mathworks.com/help/matlab/ref/repmat.html repmat> function

12 years ago | 0

Answered
Merge structures with overlapping fieldname
d.ID=[data.set1.ID;data.set2.ID] d.type=[data.set1.type;num2cell(repmat(nan,numel(data.set2.ID),1))] d.num=[repmat(nan,numel...

12 years ago | 0

Answered
change file name on execution
for k=1:10 file=sprintf('Plate_%d.jpg',k) f{k}=imread(file); end

12 years ago | 0

| accepted

Answered
Opening a new script in a new tab
Try this to get default layout desktop = com.mathworks.mde.desk.MLDesktop.getInstance; desktop.restoreLayout('Default')

12 years ago | 0

Answered
exp function on vector
If t=0:0.1:500 t(400) and t=400 are different

12 years ago | 0

Answered
Extract sparse block diagonal without loop
r=4; c=3; n=100; [nr,mc]=size(A); jdx=repmat(1:mc,r,1); idx=permute(reshape(repmat(1:nr,c,1),c,r,[]),[2 1 3]); ii=sub2in...

12 years ago | 0

Answered
reshape an array of un even matrix
out=reshape(y,250,8)

12 years ago | 0

| accepted

Answered
Extract sparse block diagonal without loop
ii=A(A~=0); B=reshape(ii,3,3,size(A,1)/3)

12 years ago | 0

Answered
envisioning the execution of a program
Use tic toc

12 years ago | 0

Answered
Using Rand to generate binary encoded as +/- 3 volts
T = 6*(rand(1,10000) <= 0.5)-3

12 years ago | 0

Answered
Convert layers of 3D matrix to list of cells
*Edit* x(:, :, 1) = magic(3); x(:, :, 2) = 2*magic(3); x(:, :, 3) = 3*magic(3); x=arrayfun(@(ii) x(:,:,ii),1:size(x,3),'...

12 years ago | 0

Answered
help please (error: number of elements must be the same)
What do you want to create with this? member(i)=[ joints(i,1);joints(i,2) ]; Maybe you want member(1:2,i)=[joints(i...

12 years ago | 0

Answered
How can I double a vector and to the second part of it add a number?
R=[1; 2; 3; 4; 5; 6; 7; 8; 9; 10] R=[R;R+360]

12 years ago | 0

| accepted

Answered
how to plot graph in gui?
X=[2 4 7] Y=[4 6 8] h=plot(X,Y,'--r','LineWidth',1)

12 years ago | 0

| accepted

Answered
How can i get the final value of a step signal as a constant?
set the *step time* parameter of your *step* block to 0 or use a *constant* block

12 years ago | 0

Answered
Comparing elements of matrix of different Sizes dimension in Matlab
A=[1 2 3;4 5 6;7 8 9;1 0 1] B=[1 3 2] C=bsxfun(@eq,a,b) For floating point numbers look at Analyst link

12 years ago | 0

| accepted

Answered
Get 2d Affine transformation from 2 pair of points
T = X_prime./X;

12 years ago | 0

Answered
Arrays and finding a chain of ones
x0=[1 1 1 0 0 1 0 1 1 1 1 1 0 0 1] x=[0 x0 0] idx1=strfind(x,[1 0])-1 idx0=strfind(x,[0 1]) [max_length,ii]=max(idx1-idx0+...

12 years ago | 0

| accepted

Answered
Need to convert char to struct
str='12.03,23,25,26,30' a=struct('data',num2cell(str2double(regexp(str,'[\w\.]+','match'))))

12 years ago | 0

Answered
how to save a vector coming from a function, into a matrix?
fileNames=dir(fullfile('D:\Project\HSV\New Folder\*.bmp')) ; my_vector=zeros(256,3); for k= 1:length(fileNames) ...

12 years ago | 1

| accepted

Answered
How can I count the frequency of each element of one vector?
a= [7 4 9 6 4 10 9 6 7 6] [b,idx]=unique(a) [~,jdx]=sort(idx); [ii,jj]=histc(a,b) d=accumarray(jj',(1:numel(jj))',[],@(x) ...

12 years ago | 0

Answered
How to plot average day from monthly data
fid=fopen('file.txt') data=textscan(fid,'%s %s %s %s') fclose(fid) flow=cellfun(@(x) str2double(regexp(x,'[0-9]+(\.)?([0-9]...

12 years ago | 0

Answered
How to compare two cell elements in matlab?
Use curly brackets amp1=cinfo{1,1}; amp2=cinfo{1,2};

12 years ago | 0

| accepted

Answered
convert Cell to double
D={'10/21/2013 13:11:34.0289993' '10/21/2013 13:11:34.1289978' '10/21/2013 13:11:34.2289962' '10/21/2013 13:11:34.3290023' ...

12 years ago | 0

Answered
A logical indexing for row-wise max
x = [2 3;3 1] [a,b]=max(x, [], 2); result = zeros(size(x)); result(sub2ind(size(x),1:size(x,1),b'))=1

12 years ago | 1

| accepted

Answered
How do I delete rows in a table if they contain a specific string?
If str is your cell array str={'03_f_calm_open_scr_f.jpg' '03_f_calm_open_scr_f.jpg' '03_f_fear_open.jpg' '03_f_fear_ope...

12 years ago | 0

Load more