Answered
How to import parameter values from m-file to simulink?
Use annotations <http://www.mathworks.com/help/simulink/ug/annotations.html#responsive_offcanvas>

10 years ago | 0

Answered
To store many double arrays in a double array
a=[1 2 3] b=[4 5 6] c=[a b] <http://www.mathworks.com/help/matlab/learn_matlab/matrices-and-arrays.html>

10 years ago | 0

Answered
ODE23 taking in 3 variables
You have 3 variables z(1),z(2) and z3, you need to write 3 equations dydx(1),dydx(2) and dydx(3), for example dxdy = [z(3)...

10 years ago | 0

| accepted

Answered
MATLAB is not plotting the entire graph
Correct the last lines Cbs = Cas*(k1)./((F./V)+k2) plot(F,Cbs)

10 years ago | 1

| accepted

Answered
To read a .dat file by replacing 'nil' s with zeros
fid=fopen('file.dat') v=textscan(fid,'%s') fclose(fid) w=reshape(v{:},3,[])' w=strrep(w,'nil','0') out=str2double(w)

10 years ago | 1

Answered
How can I cut parts of a matrix based on numbers in two other matrices?
M2=rand(5,5,5); M3=rand(5,5,5); M1=rand(4,4,4) [n,m,p]=size(M1); M22=M2(1:n,1:m,1:p); M33=M3(1:n,1:m,1:p); idx=~(M1>M22 ...

10 years ago | 0

Answered
How to return from reshape function?
y=rand(24000,1) x=reshape(y,150,160) out=x(:)

10 years ago | 0

| accepted

Answered
Need to find the Y value at X = 0!! Extrapolation!!
y0=interp1(x,y,0,'linear','extrap')

10 years ago | 1

Answered
cell array output format
v={'BUY' 'SELL' 'BUY'} char(v)

10 years ago | 0

| accepted

Answered
Binary string to character conversion
x = char('0' + (rand(1, 1000) < 0.5)) a={'-3d' '-d' '+d' '+3d'} idx=bin2dec(reshape(x,2,[])')+1 out=a(idx) If you wan...

10 years ago | 0

| accepted

Answered
Array of 1 and 0 to decimal
A = [1 0 0 1 0 0 1 1; 0 0 0 0 1 1 1 1; 1 0 1 0 1 0 1 0 ]; out=A*2.^(size(A,2)-1:-1:0)'

10 years ago | 0

Answered
Set string labels for a plot with multiple lines
A=[1 2 3 8]; B=[2 4 5 6]; C=[5 7 11 12]; xaxis = [1:4]; semilogy(xaxis,A,'o-',xaxis,B,'o-',xaxis,C,'o-') xlabel1={...

10 years ago | 1

| accepted

Answered
How can I do loop for struct data?
a=struct('f',num2cell(1:10)) out=[a.f]

10 years ago | 0

Answered
How to get millisecond from time display
datestr(clock,'YYYY/mm/dd HH:MM:SS:FFF')

10 years ago | 3

| accepted

Answered
Taylor series calculation sin(x)
This a function, you can't run it like you run a script. You need to save it as sinus.m then from the windows command type ...

10 years ago | 1

Answered
Writing two Matrices in table format using fprintf
Use |[t;h]| instead of |[t h]'| saveTxt = fprintf(text_table, '%8.2f %8.3f\n', [t;h])

10 years ago | 1

| accepted

Answered
convert matrix into cell
a=int64(1:3)'; out=num2cell(a)

10 years ago | 0

| accepted

Answered
how can i divide a circle into 15 equal sectors in matlab?
alpha=-pi:0.01:pi; n_sect=7 sect=2*pi/n_sect clr='bgrycmk'; for k=1:n_sect a0=-pi+(k-1)*sect a1=-pi+k*sect ...

10 years ago | 0

Answered
Creating for loop for matrixes?
To=cell(1,10); Fo=To; for k=1:10 autocor=xcorr(x(:, 1)); [pks,locs] = findpeaks(autocor) X=pks; [a,z1]...

10 years ago | 0

| accepted

Answered
change the scale on graph
You mean to change the ticks of your axis. For example x=0:10 y=cos(x) plot(x,y) number_of_ticks=5 xt=xlim set(gca,'xt...

10 years ago | 1

| accepted

Answered
Lowest differential in data group
Apply the same function to -A (A is your matrix)

10 years ago | 0

Answered
Hi, Matrix index is out of range for deletion.
ErkBas{j}(end+1) doesn't exist. Example a=[1 2 3] a(end+1)=[]

10 years ago | 0

| accepted

Answered
how to copy rows and columns in a random matrix ?
S=randi([0 1],size(A)) S([1 end],:)=A([1 end],:) S(:,end)=A(:,end)

10 years ago | 0

Answered
To store elements with different datatypes from loop
Use cell arrays M{1}=[1 2 3]; M{2}=5 M{3}='text'

10 years ago | 0

| accepted

Answered
if i have random matrices how to find a specific matrix?
A = [ 1 0 1 1 0 1 0 0 1 1 0 1 1 1 0 1 ] for k=1:20 s = randi ([0 1 ] ,4,4); M{k}=s; S(k)=(sum (...

10 years ago | 0

Answered
How do I run fmincon within SIMULINK
Use Matlab function block <http://www.mathworks.com/help/simulink/slref/matlabfunction.html>

10 years ago | 0

Answered
I want to add some elements of a vector depending on the elements of other vector
t=[1; 1; 1; 2; 2; 3; 3; 3; 3] x=[10; 11; 12; 21; 24; 30; 30; 40; 30] v=accumarray(t,x) [~,jj]=unique(t,'last') out=ze...

10 years ago | 0

| accepted

Answered
Indexing cannot yield multiple results.
Check if *size* was not used as a variable. For example size=2 [n,m]=size(rand(4)) To resolve the problem type cle...

10 years ago | 0

Answered
How to matrix combine adjacent row to be a new matrix ?
B=A(:,1:2:end)+A(:,2:2:end)

10 years ago | 0

| accepted

Load more