Answered
observability staircase form for MIMO system
* obsvf: gives you another state representation (observable forme) * obsv(A,C) returns the observability matrix [C; CA; CA^2 ...

14 years ago | 0

Answered
vectorize a for loop
eval(sprintf('isPeak(start_peak_hour(%d):end_peak_hour(%d)) = 1,',[1:n_peak;1:n_peak]))

14 years ago | 0

Answered
How can i change a subblock as a source for a help description?
* write any text you want in your model * select your text and right click on it then click annotation properties * a wind...

14 years ago | 0

Answered
derivate of x y points
Diff(y)./diff(x)

14 years ago | 0

| accepted

Answered
How to randomly select variable from the range of numbers ?
a=[1:1:100] out=a(randi(100,1,5))

14 years ago | 0

| accepted

Answered
how to clear all selected listbox items
set(handles.yourlistbox,'enabled','off')

14 years ago | 0

Question


systematic: Do not use global, don't use eval
I don't agree with systematic: don't use eval, or global or ... and my question is why those command are still not removed by M...

14 years ago | 9 answers | 14

9

answers

Answered
How do I plot a feather plot with arrow with the following data? Thanks.
Example t=linspace(0,10,400) y=sin(t) data=[t' y'] % suppose data is your array plot(data(:,1), data(:,2))

14 years ago | 0

Answered
How can I get the variable from inside of the for loop and use it /display it after for loop?
That depends where your loop is, in script file or function file If it's in Function file, that have nothing to do with a loop ...

14 years ago | 0

| accepted

Answered
plotting graph in simulink
To plot those graphs you have to identify what they represent, then find a function or a model that generate them. I don't think...

14 years ago | 0

Answered
forming the transformation matrix
* The first image represents Park transformation, you can use two Matlab function for Direct and inverse transformation. * Th...

14 years ago | 1

Answered
How can I connect two seperate Simulink models?
Use two scripts in each session of matlab. for example script1 x=load('comunicat') if x.test==1 sim('model1') ...

14 years ago | 0

Answered
Admins need to give a reason when they close a question!
I don't agree with closing a question because it's not a Matlab question, because I've seen several answered questions that se...

14 years ago | 1

Answered
if statement between cells arrays
out=unique(p(cellfun(@(x) ~ismember(x,c),p)))

14 years ago | 1

| accepted

Answered
Problem with a loop for
T=30; N=100; V=rand(N,T); % Example out=cell2mat(arrayfun(@(x) mean(V(:,max(x-4,1):max(x-1,1)),2),1:T,'un',0));

14 years ago | 0

Answered
remove rows that contain zeros from cells array in matlab
out=m(all(cellfun(@any,m),2),:)

14 years ago | 1

Answered
How do we plot a graph with non available values for y without breaking the continuity?
Use interpolation x=M(:,1); y=M(:,2); idx=find(~isnan(y)) y=interp1(x(idx),y(idx),x,'linear') or remove rows contai...

14 years ago | 3

Answered
How to create a matrix from given vectors
A= [ 2 4 1 3 ]; n=length(A); s=meshgrid(1:n); out=cell2mat(arrayfun(@(x,y) y<=A(x),s,s','un',0))

14 years ago | 0

Answered
Error-Initial state vector "X0" must be a real vector of length 86
In the home page of Matlab, on the top-middle there is a "current folder" by default it's F:\Old\bck\Program Files\MATLAB...

14 years ago | 0

| accepted

Answered
Difference between fprintf and fwrite?
* fprintf, write data to text file * fwrite, write data to binary file

14 years ago | 2

| accepted

Answered
how to add Pulse Generator(triggered) to Embedded function
What is shown in your image is not *"Embedded Matlab Function"* block, it's a *triggered subsystem* that probably, contains an *...

14 years ago | 3

| accepted

Answered
how to import data into matlab
fid=fopen('data1.txt'); A=textscan(fid,'%s%s%s%s%s%s%s%s%s%s%s%s%s','delimiter',','); fclose(fid);

14 years ago | 0

| accepted

Answered
I am wondering how I can draw circle seperated by two color...
x=-1:0.01:1 y1=sqrt(1-x.^2) plot(y1,'r') hold on plot(-y1,'b') or more general c=1+2j % circle centre r=4 % ...

14 years ago | 0

Answered
How create a model in SIMULINK using Embedded Matlab Function?
you can use |*Embedded function*| ( called with recent versions: Matlab function)from |Simulink/user defined function.| But you ...

14 years ago | 1

| accepted

Answered
How can I use randperm.m to convert one matrix to another?
A=magic(6) % example [n,m]=size(A) B=cell2mat(arrayfun(@(x) A(x,randperm(m)),(1:n)','un',0))

14 years ago | 0

Answered
Can't change matlab priority in windows
I think RTW handle setting higher priority to your application.What we need is that your model runs with higher priority (not th...

14 years ago | 0

Answered
how to find maximum or minimum element in a matrix?
a=5;b=8;c=2;d=6 x=[a b c d]; y={'a','b','c','d'}; [c1,idx1]=max(x); [c2,idx2]=min(x); max_x=y{idx1} minx_x=y{idx2}

14 years ago | 1

| accepted

Answered
Toggle Button callback difficulty
Think about adding another value=get(hObject,'value'); if value==get(hObject,'Max') inside the loop

14 years ago | 0

Answered
trouble using "mean" function in MATLAB?
Maybe you want mean(A(1:3))

14 years ago | 1

Answered
About floor function problem.
Just try without floor a=1.99999999999999999999999999

14 years ago | 0

Load more