Answered
Chose a random integer between an upper and lower limit.
c=randi([a b])

12 years ago | 1

| accepted

Answered
randi size inputs not scalar issue?
randi(length(characters ), 1, (passwd_length-1)) |passwd_length-1| should be a scalar not a vector

12 years ago | 0

| accepted

Answered
Error using plot3 - Vectors must be the same lengths.
In your code there is an error with z1 and z2 z1 = 1;end_limit; it should be z1 = 1: end_limit; and z2= 1...

12 years ago | 0

Answered
Can i append a matrix with integers and a matrix with string on it
You can use cell array names={'a' 'b' 'c'} data=[1 2 3;4 5 6] out=[names;num2cell(data)] You can also convert to datas...

12 years ago | 1

Answered
Help with for cycle in a vector
x = [3,6,4,5,1,7,9,8,5] p=mod(-numel(x),3) x(end+1:end+p)=mean(x(end:-1:end-(3-p)+1)) out=mean(reshape(x,3,[]))

12 years ago | 0

| accepted

Answered
Unable to open .csv file ("Error using importdata (line 136) Unable to open file")
dd = dir('C:\Users\...\*.csv'); n=numel(dd); for k=3:n; filename=dd(k).name; A{k}=importdata(filename); ... end...

12 years ago | 0

Answered
how to use result of one function for another function??
Save this function as heatsource.m function [ y ] = heatsource( c,d ) [ x1, x2] = result( c, d ) y=x1+x2 function [ x1, ...

12 years ago | 0

Answered
how to find a string within a cell array
p='10 Hz: Time_abs' A={'10 Hz: Time_abs';{'yytt' 'rr'};{'yyt2t' 'rr1'}} A(cellfun(@(x) any(strcmp(x,p)),A))=[]

12 years ago | 1

| accepted

Answered
problem with understanding the operators and special characters
You can test it in Matlab windows command % If your current forlder is D:\a\b, after cd('../') The current folde...

12 years ago | 0

| accepted

Answered
How can I visualize a Stateflow model ?
I don't think you can get those colors just by using Simulink. If you have a 3D world Editor, you can use a VRML Builder to draw...

12 years ago | 0

Answered
question about surf function
t = linspace(0,2,100) x = linspace(0,10,100) [X,T]=meshgrid(x,t) U = 10*sin(2*pi*(T-X/5))+2*sin(2*pi*(T+X/5)) surf(X,T,U) ...

12 years ago | 0

| accepted

Answered
What's wrong with this script?
t = linspace(0,2,100) x = linspace(0,10,100) U= 10*sin(2*pi*(t-x/5))+2*sin(2*pi*(t+x/5))

12 years ago | 0

Answered
How does Simulink recognize variables from an m-file?
Don't use the same name, also avoid the name system. Before running your simulink model, you have to run your m-file If you w...

12 years ago | 0

Answered
How to sum two rows in a matrix?
a = [4 2 1;1 9 6;4 22 4;12 15 1;1 6 8;5 2 6] b=sum(reshape(a',2*size(a,2),[]))

12 years ago | 0

| accepted

Answered
Count number business days per month
n=max(0,fix(log10(data)+1)-6) b=fix(data./10.^n) c=unique(b); f=histc(b,c); q=uint8(rem(c/100,1)*100); p=arrayfun(@(x) da...

12 years ago | 0

Answered
Problem, when trying to differentate sin(f(x)), with variable x
syms x a=sin(3*x) b=diff(a,x) The result is b = 3*cos(3*x)

12 years ago | 0

| accepted

Answered
Vector 0 to 2pi with 1000 point equal spacing
linspace(0,2*pi,1000)

12 years ago | 4

Answered
Find pattern of ones
A=[ 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 ]; a=[0 A 0]; ii1=strfind(a,[0 1]); ii2=strfind(a,[1 0])-1; out=fix((ii2-ii1+1)/4)

12 years ago | 0

| accepted

Answered
How to delete an element from a cell
a=[19970422;30980524;63098754] b=arrayfun(@num2str,a,'un',0) out=cellfun(@(x) str2num(x(1:4)),b) %or a=[19970422;309...

12 years ago | 1

Answered
Vertical to horizontal data
a=rand(12500,1); % Example n=numel(a); ii=mod(-n,62), a(end+1:end+ii)=nan out=reshape(a,62,[])

12 years ago | 0

| accepted

Answered
Matlab gives different eigenvalue for same matrix
Look at <http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F>

12 years ago | 0

Answered
multi-dimensional array, minimum, coordinate
a=rand(3,4,5); [min_v,idx]=min(a(:)) [ii,jj,kk]=ind2sub(size(a),idx)

12 years ago | 0

| accepted

Answered
When use || and | in if?
a||b will return 1 if the first expression a is true, without evaluating the second expression b Example 2==2 || hhh ...

12 years ago | 1

| accepted

Answered
comparing the missing value
a= [3 4 5 1 9 2 0] b= [4 0 5 9 1 2] out=setdiff(a,b)

12 years ago | 0

Answered
How can I compare columns from 2 different numeric arrays and when they match define a new column in array A with the value of a second column in array B?
A(:,1)=[1 2 3 4 5 6] B(:,1)=[0 0 0 2 0 5] B(:,2)=[20 20 20 10 80 60] %----------------------------- idx=B(:,1)~=0 A(B(idx...

12 years ago | 1

| accepted

Answered
plotting a graph error
at the end of your line code, add a semicolon *;*

12 years ago | 0

Answered
how to take a function to handle as input
Use str2func function str=input('your function','s') f=str2func(str)

12 years ago | 3

| accepted

Answered
how to solve Error using * ?
syms x p = (316198015299*cos((35493*x)/100000))/50000000000000 - (250931707863*cos((70753*x)/10000)*exp(-(23077*x)/10000))/12...

12 years ago | 0

Answered
Matrix from a for FOR loop with IF conditioning
A = [1 2 3; 4 5 6; 7 8 9] A(2:2:end,:)=fliplr(A(2:2:end,:)) %Or if you want to do it with a for loop A = [1 2 3; 4 5 ...

12 years ago | 0

| accepted

Answered
How to concatenate rows ?
reshape(A',1,[])

12 years ago | 1

| accepted

Load more