Answered
how to create a specific matrix from an array
A=[1 2 3 4 5 6 7] m=5; n=numel(A); B=zeros(3,m); for k=1:3 B(k,:)=A(k:k+m-1); end disp(B) %or m=5; n=num...

13 years ago | 0

Answered
Create and populate field on existing structure. Impossible?
f=fieldnames(MyStruct) g=struct2cell(MyStruct) [n,m]=size(g) g(n+1,1:m)=num2cell(DFullData{:,5}) MyStruct=cell2struct(g,[f...

13 years ago | 0

Answered
Convolution of rect (t/2) and δ(t+2) - δ(t+1)
rect=@(t) heaviside(t+1)- heaviside(t-1)

13 years ago | 0

Answered
Create and populate field on existing structure. Impossible?
n=numel(DFullData{1,5}) for k=1:n MyStruct(k).Field3=DFullData{1,5}(k) end

13 years ago | 0

Answered
Sorting a Matrix using Indices from another matrix !
[m,n]=size(A); A=A(sub2ind([m n],idx,repmat(1:n,m,1)))

13 years ago | 5

| accepted

Answered
Sorting a Matrix using Indices from another matrix !
*Edit2* A = [1 1 1 0 0 0; 0 0 0 1 1 1; 0 1 0 1 0 1]' idx= [4 5 6 3 2 1; 1 2 3 6 5 4; 6 5 4 3 2 1]' [m,n]=size(A); idx=bs...

13 years ago | 1

Answered
Does Matlab choose the compilers in the mex -setup based on compilers it finds on the laptop or does it give a list of compaitble compilers as in the list below
It lists all compilers working with your Matlab version, even those compilers are not installed.

13 years ago | 0

| accepted

Answered
repeat last column and last row of a matrix
A(:,end+1)=A(:,end) For the second matrix A(end+1,:)=A(end,:)

13 years ago | 1

| accepted

Answered
How can I access SimPowerSystems toolbox
Click on Simulink, you will find it

13 years ago | 0

Answered
using normrnd function in a loop
rng(14) % choose your seed for i = 1 :10 x(i) = normrnd(1,0.2) end

13 years ago | 0

Answered
How do I code to normalize a matrix by dividing each index by the max abs value in the row
A=[2 7;8 10] out=A/max(abs(A(:)))

13 years ago | 0

| accepted

Answered
what is the form of the matrix B
There some errors in your code A=[1 2 3 ;4 5 6; 7 8 9] for i=1:size(A,1) for j=1:size(A,2) if j==1 ...

13 years ago | 0

Answered
How can i vectorize this assignment to a structure array?
I think your for loop is the better way to do it. Are you trying to make your code faster?

13 years ago | 0

Answered
Going up from negative in for loop counter
You can avoid using negative index x=-10:10; n=numel(x); y=zeros(1,n) % Pre-allocate for k=1:numel(x) y(k)=-3*x(k...

13 years ago | 2

| accepted

Answered
sum function not working
You've probably used sum as a variable. Check in your code, you will find that sum was used as a variable. Clear the variable su...

13 years ago | 12

| accepted

Answered
How can I have access to an image?
<http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F>

13 years ago | 0

Answered
plot saved data in the sope
You can use a <http://www.mathworks.com/help/simulink/slref/fromworkspace.html From Workspace> blocks. If y is your saved struct...

13 years ago | 0

| accepted

Answered
Chunking a portion of raw data
Example A=rand(2198560,1); A(1:143100); %----------------------- a1=a(1:numel(a)/2); a2=a(numel(a)/2+1:end)

13 years ago | 0

Answered
Grouping matrices under a
vertcat(A,B) If you have many arrays. For example a=[] for k=1:10 x=(1:k)' a=vertcat(a,x) end %...

13 years ago | 0

| accepted

Answered
sort rows of a matrix based on their maximum value
*Edit2* [ii,ii]=sort(max(A')) BB=A(ii,:)

13 years ago | 0

Answered
Using function as arguments
You can use f=@yourfunction Example f=@cos f(1) Look at doc function_handle doc str2func

13 years ago | 0

| accepted

Answered
Why do my loop never end?
That means that |X(i)-x(i)>tol| is always true

13 years ago | 0

| accepted

Answered
plotting discrete time signals
% You have so n = [-5 -4 -3 -2 -1 0 1 2 3 4 5]; f_one = 2*0.5.^n.* heaviside(n+2) stem(n,f_one) % The operator *.+...

13 years ago | 1

| accepted

Answered
How do I get the maximum value for x with its corresponding y value?
Example A=[1 2;3 4;47 20;5 55] [xmax,idx]=max(A(:,1)); ymax=A(idx,2)

13 years ago | 0

| accepted

Answered
How to I specify rows that are evenly spaced?
A(30:38:end) %Example A=rand(1474,1); out=A(30:38:end); plot(out)

13 years ago | 0

Answered
question on cell array
for k=1:numel(K) if K{k}(1)==0 K{k}=K{k}(2:end); end end

13 years ago | 0

Answered
Plotting a Stacked Bar graph using different X values
x1 = [1 2 3] x2 = [2 3 4] y1 = [5,6,7] y2 = [10,12,21] x=unique([x1 x2]) yy1=nan(1,numel(x)); yy2=yy1; yy1(ismember(x...

13 years ago | 1

| accepted

Answered
Converting dates into numbers
x=int32([19921212,19921213,19921214])' y={'12:12', '13:13','14:14'}' a=[num2str(x) char(y)] b=datenum(a,'yyyymmddHH:MM') d...

13 years ago | 0

| accepted

Answered
randomly picking some files
your_folder='E:\matlab'; d=dir([your_folder '\*.wav']); f={d.name}; n=numel(f); idx=randi(numel(f)); file=f{idx} f(idx)=...

13 years ago | 1

Answered
Indices to zeros in Matrix
find(any(~A,2))

13 years ago | 1

Load more