Answered
Matrix manipulation with vectors
A(1:46,1) % first column from 1 to 46

14 years ago | 0

| accepted

Answered
Chaging the outupt integers
M=256; N=256 A=fix(2*rand(M,N)); A(A==0)=-1

14 years ago | 0

| accepted

Answered
How to load .dat (or even .txt ) files into matlab workspace?
fid = fopen([yourpath '/' 'file.txt']); line1 = fgetl(fid); res=line1; while ischar(line1) line1 = fgetl(fid); res ...

14 years ago | 0

Answered
Matrix build: Switch/Case and For loop
Just write *case {2,3}* i=2 switch i case 1 A(i,1) = -4; A(i,2) = 1; ...

14 years ago | 0

Answered
Rotation of Matrix Errors
rotate(u,[1 0 0],45) u should be a handle of your plot h=plot(u) rotate(h,[1 0 0],45)

14 years ago | 0

Answered
Function to find ar coefficients using Least squres
Construct your measure matrix Fi, yourcoeff=FI\y Example % y(n)=a1 y(n-1)+a2 y(n-2)+ a3 y(n-3) your system % if y...

14 years ago | 1

| accepted

Answered
Sampling with vectors at the same time
Maybe you mean indexing v=[2 3 5 4 10 20] d=[2 3 1 4 5 6] new_v=v(d)

14 years ago | 0

Answered
Applying a Function to Every Element of a List
arrayfun(@(x) f(x,a),L,'un',0) read doc arrayfun doc cellfun Example L=randi(10,1,10) out=arrayfun(@(x) ma...

14 years ago | 0

Answered
how to draw Sudan Country flag
close hold on larg=6 long=10 x=[0 0 long long 0 0 long long long 0]; y=[larg 0 0 larg/3 larg/3 2*larg/3 2*larg/3 larg/...

14 years ago | 1

| accepted

Answered
How to Rename and Delete empty files using Mat-LAB?
To rename files. For example liste_of_files={'rawdat001','rawdata002',...,'rawdata10'} You want to rename them with ...

14 years ago | 0

| accepted

Answered
Problems while setting BackgroundColor of a Simulink masked subsystem
If your subsystem is called *ICE_2_ECLTUCH* and your simulink model called *untitled* set_param('untitled/ICE_2_ECLTUCH','b...

14 years ago | 0

| accepted

Answered
Error: Index exceeds matrix dimensions.
What you should do is for k = 1 : size(a,4) source(k).cdata = a(:,:,:,k); source(k).colormap = []; end

14 years ago | 0

Answered
Invert a set of multiple matrices - efficiency & time issues
It's not 15000x5x5 but 5x5x15000 %Your data matrices_array=rand(5,5,15000); n=size(matrices_array,3); %First way ...

14 years ago | 0

Answered
Use of this symbol [~]
Example x=[2 1 3 0 5] [val,idx]=sort(x) The result val = 0 1 2 3 5 idx = 4 2 ...

14 years ago | 5

| accepted

Answered
How to get the source directory from command window?
[filename,path]=uigetfile('*.mdl') % path is your file location file=fullfile(path,filename)

14 years ago | 0

Answered
Delete first 8 bits of data
You can't write A=[11111111 00000000] because it gives A=[11111111 0] If you have A=['11111111'; '0000000...

14 years ago | 0

Answered
How to add one scatter plor to another?
%or you are looking for x1 = [0, 2, 4, 8, 1, 10] x2 = [2, 9, 11, 13, 5, 7], y1=x1.^4; idx1=find(ismember(x1,x2)) ...

14 years ago | 0

Answered
can a white space be included in a switch statement?
Yes you can a=' ' switch a case ' ' d=10 case '1 2' d=1000 end

14 years ago | 0

Answered
Why am I not getting the expected result?
You don't need to create a function for this x=zeros(size(y)) x(y==1)=1 and x is not used in your code

14 years ago | 1

| accepted

Answered
Random numbers within 2 ranges
[randi(100,1,100);randi(100,1,100)+199]

14 years ago | 0

Answered
Concateniting the results of two “finds”
Your code can be done like this tolerence=0.01; y=0.05*(rand(5)-0.5) % your data x=zeros(5) x(abs(y)<=tolerence)=1 ...

14 years ago | 0

Answered
How to add one scatter plor to another?
x=[x1 x2] y=[y1 y2] [val,idx]=sort(x); new_x=val new_y=y(idx) plot(new_x,new_y)

14 years ago | 0

Answered
how can i change pulse width in simulink?
You change the sample time of your blocks or the fixed step time.

14 years ago | 2

| accepted

Answered
Figure Toolbars missing when using plottools
set(gcf,'toolbar','figure') set(gcf,'menubar','figure')

14 years ago | 1

| accepted

Answered
m-file code to simulink block
If you have calculated a signal with your m-file, you can save it in a mat-file, then use a *from file* block. Specify what do y...

14 years ago | 0

Answered
help with problem using xlswrite
Your data should be like Ta={'Turbidity' '2011-09-13 01:00:00' '2011-09-13 01:00:00' 'Turbidity' '2012-01-25 23:00:...

14 years ago | 0

Answered
How can I change the line width in a graph which is generated by rlocus command ?
Without opening figure properties, select any point of your plot, then in windows command type: set(gco,'LineWidth',4) %...

14 years ago | 1

Answered
Finding all possible row combinations of a matrix that add to zero
Try this code A = [-1 0 0 ;1 0 0; 1 -1 0 ; 0 1 -1 ; 0 1 -1; 0 0 1]; n=size(A,1) idx1=npermutek([0 -1 1],n); p=size(idx1,1...

14 years ago | 0

Answered
In a struct, how can you extract values for a vector of fieldnames
*Edit* if *a* is your struct array s=fieldnames(a) out=a rmfield(out,s(4:end)) % will remove fields from 4 to the en...

14 years ago | 0

Answered
Solve Function not working properly
syms x sol=solve(x.^3-6*x.^2+18) sol=subs(sol)

14 years ago | 0

Load more