Answered
Matrix Dimensions Must Agree
R{i,j}=Mb{:,j}/b{i,j}; what is |Mb{:,j}|? and why |*Mb=max([b{:,2}])*|?

14 years ago | 0

Answered
How to give if...then condition ?
e=5e-03 if A1<=A, e=0 else e = v/[u/e - 2] end

14 years ago | 0

Answered
pause a Programming in matlab
Use break point

14 years ago | 0

Answered
Assign a letter to a set of (for example) real numbers?
No, the problem is that n, m & a are unknowns! set for example n=2; m=2; a=10 for i = 1:m for j = 1:n ...

14 years ago | 0

| accepted

Answered
ismember function too slow
use ismember out of the loop A=[1 2 3 4 5 6 7 8 9 10] B=[3 4 11 9 22] idx=find(ismember(B,A)==1) for k=idx %do ...

14 years ago | 0

Answered
Time format conversion command
t={'36:40.0' ,'37:40.0' ;'39:40.0' ,'31:40.0'} out=cellfun(@(x) sum(cellfun(@str2double, regexp(x,'[:.]','split')).*[3600 60 ...

14 years ago | 0

| accepted

Answered
Wrap cell values in single quote so that regexprep works
B= cellfun(@(x) regexprep(char(x),'N','99'),C,'un',0)

14 years ago | 0

Answered
Indexing matrix using logicals
a=[10 13 14 15 16;11 12 15 16 17; 3 5 8 9 12]; [n,m]=size(a) b=a<11.5 out=arrayfun(@(x) max(find(b(x,:)==1)),1:n)+1 out(...

14 years ago | 0

Answered
How can I modify the manipulated variable properties in a MPC block in Simulink?
pass your input signal through a |*zoh*| (zero order hold) block from |*simulink/discret*|. or set your signal source datype to ...

14 years ago | 0

Answered
How can we change output state of delay block during simulation ot its initial value using command prompt
if |ModelName| is your model name set_param('ModelName/Unit Delay','x0','10')

14 years ago | 1

Answered
Concatenate string output to another string vertically in a loop
s=[] for k=1:10 s1=['text' num2str(k)] s=strvcat(s,s1) end

14 years ago | 3

Answered
How to get the values on a given axis of a given figure ?
x=0:0.1:10; y=sin(x) plot(x,y) %select a plot in your figure, then run this: xdata=get(gco,'Xdata') % to get X-axis...

14 years ago | 0

| accepted

Answered
Sort Matrix by Columns (descending by the number NaN entries)
A=rand(10);ii=randperm(100);A(ii(1:40))=nan %example [c,idx]=sort(sum(isnan(A))) out=A(:,idx)

14 years ago | 0

| accepted

Answered
Row by column multiplication
for k=1:10 matrix{k}=B(:,k)*A(k,:) end %or for k=1:10 matrix(:,:,k)=B(:,k)*A(k,:) end

14 years ago | 0

Answered
3d to 2d matrix
[r,c,w]=size(reflectances) A=reshape(reflectances(:),r*c,[])'

14 years ago | 1

Answered
can I convert data array to data structure with time?
t=0:0.1:10; y=sin(t) data=struct('time',t,'signal',y)

14 years ago | 0

| accepted

Answered
How to construct an array from two arrays of different sizes using conditional replacement of elements?
C=nan(numel(A),1) for k=find(ismember(A,B(:,1))==1) C(k)=B(find(B(:,1)==A(k)),2) end

14 years ago | 0

| accepted

Answered
about error in stateflow
You have an algebraic loop means that in your model you have a feedback through a block which don't contain any delay, it's lik...

14 years ago | 0

| accepted

Answered
number of element are not equal
use |*| instead of |.*| , the problem is in your last for loop for i=1:(N-1) Ia(i) = Ia - (IL - Ia - I0.*( exp((Vc(i)+Ia.*...

14 years ago | 0

| accepted

Answered
check a variable is a symbolic or a double
syms a b=10 class(a) class(b)

14 years ago | 3

| accepted

Answered
Variables not saved after function completes. Help needed
In your function use data=load(filename) If filname.mat contains variables x y and z, you can get them, after caling your...

14 years ago | 1

Answered
Can I perform subtraction using cell arrays?
A ={ 3594 3627 3626 3625 3610} B ={ 3648 3621 3613 3620 3626} res=cellfun(@(x,y) y-x,A,B)

14 years ago | 0

| accepted

Answered
Function M-Files Help
your code is fine, maybe you did'nt call the function correctly example, to call your function, go to matlab command, then ...

14 years ago | 0

| accepted

Answered
Reading numbers from alphanumeric strings in a cell matrix
A={'N010' 'G00' 'X0' 'Y0' 'Z0' 'N020' 'G01' 'X-10' 'Y10' 'Z-1' 'N030'} y=cell2mat(cellfun(@(x) str2num(cell2mat(regexp(x,'-...

14 years ago | 0

Answered
Accessing var content in column, not location
If you want time add all(time_at,1)

14 years ago | 0

Answered
calculating the time constant
yi=y(end) idx=max(find(abs(y-yi)>=0.37*yi)) % |idx| the corresponding index

14 years ago | 0

| accepted

Answered
Plotting y vs x in an inseparable form
A=1;B=2;C=3;D=4 x=1:0.1:5; for k=1:length(x) v=[A B*(C+x(k)) D] sol{k}=roots(v) end s=cell2mat(sol) plot(s')

14 years ago | 0

Answered
improve this function in terms of speed
function [ruffled_head] = ruffle_head(head_rcv) rufled_head=0; while rufled_head==0 ruffled_head = head_rcv(randi(len...

14 years ago | 0

Answered
can not get the answer
V=[3 7 4 5 2 6]; x=[1 7 8 17 22 27]; y=[28 18 16 2 10 8]; for i=1:30 for j=1:30 c(i,j)=0; % modificatio...

14 years ago | 0

| accepted

Answered
Simulink constant parameter read inside Matlab Function block
If you have sevral parameters with the same size , you can use one constant block with value [param1 param2 ... par...

14 years ago | 3

Load more