Answered
Subtracting 2 matrices of different dimensions
a=[1 3 4 5; 3 3 4 5; 5 5 4 5 2 4 2 6 6 5 2 6 7 2 3 1] [b,idx]=unique(a(:,3:4),'rows','stable') ...

13 years ago | 0

Answered
How to create a specific matrix from a regular matrix
A=[ 1 2 3;4 5 6;7 8 9] [n,m]=size(A) B=[A;zeros(n-1,m)] out=cell2mat(arrayfun(@(x) circshift(B(:,x),[x-1 0]),1:m,'un',0)) ...

13 years ago | 0

| accepted

Answered
random numbers on the half open interval
tol=0.001; a=randi(1/tol,2000,1)*tol; %generate 2000 random numbers (0 1] % check values equal to 1 find(a==1)

13 years ago | 0

Answered
Creating Executable File from .mdl File (Simulink file)
Use a <http://www.mathworks.com/products/simulink-coder/ Simulink coder> toolbox which uses system target files to translate y...

13 years ago | 1

Answered
How can I create a block that can vary its numerical data within certain limits?
Use a constant block with value set to your increment, connected to a discrete transfer function block 1/(z-1). connect the tran...

13 years ago | 0

| accepted

Answered
How to put a impulse disturbance in a control signal of a simulink model?
Use a pulse generator block

13 years ago | 0

Answered
Default axes for plot
x=[0 1 2] y= [1.12, 5.43, 7.54] plot(x,y) set(gca,'ytick',y,'xtick',x)

13 years ago | 0

Answered
Calculate distance between vectors and generate a distance matrix
%Example v1=randi(10,100,1); v2=randi(10,100,1); %-------------------------------- [ii,jj]=ndgrid(v1,v2); out=reshape(j...

13 years ago | 0

Answered
random number generation for known sum
n=60; m=1:n; a=m(sort(randperm(60,15))); b=diff(a); b(end+1)=60-sum(b) sum(b)

13 years ago | 1

| accepted

Answered
Relational operations of vectors of different length
This will take in account only values strictly inferior [c,id]=sort([timeData,positionData]); out=c(find(ismember(id,1:nu...

13 years ago | 0

Answered
Relational operations of vectors of different length
for k=1:numel(timeData) idx=find(positionData>timeData(k),1)-1; out(k)=positionData(idx); end display(out)

13 years ago | 0

Answered
average data from excel sheet code
your_array=xlsread('yourfile.xls') %------------------------------------------------ [a,b,c]=unique(your_array(:,1:2),'rows'...

13 years ago | 0

Answered
How to import Date&Time data
a=735472; % to retrieve you date datestr(a,'yyyy-mm-dd') b=35235.416666667; datestr(b,'HH:MM:SS')

13 years ago | 0

| accepted

Answered
Not all cell converte to double
list=str2double(strrep(list,'.txt',''))

13 years ago | 0

Answered
How to use a variable defined in an .m file in another .m file without defining the variable above?
Modify your function to: function [kk,lastRR,maxloc]=Murthy(result) kk = something1 lastRR_int = something2 When yo...

13 years ago | 0

| accepted

Answered
Changing Scale on Plotyy
[ax,h1,h2]=plotyy(x1,y1,x2,y2) use the handle ax(1) to change the first axis and ax(2) to change the second one For exam...

13 years ago | 0

| accepted

Answered
Problem decimals operations Matlab
Look at <http://www.mathworks.com/matlabcentral/answers/57444-faq-why-is-0-3-0-2-0-1-not-equal-to-zero>

13 years ago | 1

| accepted

Answered
Image processing/Matrix manipulation question
M1=randi([0 255],256,256) % Your matrix 1 [x,y]=ind2sub([256 256],1:256*256); M2=[x' y' M1(:)] % %----------------------...

13 years ago | 0

| accepted

Answered
creating your own block into simulink library
# Create a subsystem. # open a new lib file # drag your subsystem to your lib file and save this lib file

13 years ago | 0

| accepted

Answered
How can I expand a matrix by replacing its elements?
out=arrayfun(@(x) circshift('10000',[0 x]),s,'un',0)

13 years ago | 1

Answered
How can I expand a matrix by replacing its elements?
p=5; a=0:p-1; b=repmat(a,p,1); s=mod(b.*b',p); s1=arrayfun(@num2str,s,'un',0) s1=strrep(s1,'0','x0') s1=strrep(s1,'1','x...

13 years ago | 0

Answered
how can I plot y=log(2,(2-a)) ?
Maybe you want this |(if log(2,b)=log(b)/log(2))| a = 0:0.2:1; C_ro = -(a/2).*log(a/2)/log(2) - ((2 - a)/2).*log((2 - a)/...

13 years ago | 0

| accepted

Answered
Real time workshop - simulation duration
When you work with Real Time Windows Target, your operating system will allow to your Matlab application the highest priority, ...

13 years ago | 0

Answered
Exporting non-rectangular cell array to delimited text file or excel spreadsheet
% Example a1=randi(9,6,1); a2=randi(9,6,1); a3=randi(9,6,1); a4=randi(9,5,1); c = {{'h1'} {'h2'} {'h3'} {'h4'};a1 a2 a3...

13 years ago | 0

Answered
using fopen, issue with the sequence files are opened
You can sort your files like this: files={'snapshot_100' 'snapshot_1001' 'snapshot_1002' 'snapshot_1003' 'snapshot_101'...

13 years ago | 0

| accepted

Answered
??? Error: File: min_max.m Line: 3 Column: 32 Unexpected MATLAB operator.
Use im=imread('moon.jpg') Do not use min and max as variables (they are Matlab functions). The same remark for your fun...

13 years ago | 0

Answered
i want to make an subsystem on or off depend on the condition
You can use <http://www.mathworks.com/help/simulink/ug/enabled-subsystems.html#brzrn88 Enabled Subsystems> or maybe <http://www....

13 years ago | 1

| accepted

Answered
Data type error using 'find'
Try this list1 = find(cell2mat(Test.TempCcol_10) == str2double(cond1));

13 years ago | 0

| accepted

Answered
Creating pairs of vector elements
% Example a=randi(9,9,1); b=randi(9,9,1); c=randi(9,9,1); %----------------------------------- [ii2,jj2]=ndgrid(a,b); [i...

13 years ago | 0

Answered
Concatenate Aphabets and numbers
Alphabet=('a':'z')' n=numel(Alphabet) [I,J]=ndgrid(1:n,1:n) I=I'; J=J'; XX=cellstr([Alphabet(I(:)), Alphabet(J(:))]) XX=[...

13 years ago | 0

| accepted

Load more