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

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)

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)
A=reshape(A,100,[]);
for i=1:100
A(:,i)=func(A(:,i)); %where func() implements the formula
end

This question is closed.

Asked:

on 19 Apr 2014

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!