Info

This question is closed. Reopen it to edit or answer.

How to apply to each sub-set of a vector a different formula?

1 view (last 30 days)
Suppose I have a vector of order 10000*1. I have to apply different formula for each subset of (100*1). how to do it?

Answers (2)

Azzi Abdelmalek
Azzi Abdelmalek on 19 Apr 2014
Edited: Azzi Abdelmalek on 19 Apr 2014
A=rand(1,1000) % example
B=reshape(A,100,10)
Then apply your formula to each column of B
Or use a cell array
B=num2cell(reshape(A,100,10),1)

Matt J
Matt J on 19 Apr 2014
A=reshape(A,100,[]);
for i=1:100
A(:,i)=func(A(:,i)); %where func() implements the formula
end

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!