Saving selected array of data from set of output array

조회 수: 2 (최근 30일)
SAZZAD HOSSAIN
SAZZAD HOSSAIN 2012년 8월 19일
Hello
My problem looks similar to the following -
for ii = 1:1000
x = cos(ii)*{a 1by1000 array}
end
Now, out of this 1000 results for x, i want to save only few data sets; like at ii=1,100,200,300....,1000. The problem that i am handling in real has millions of loops but i need just a few array. Can anyone please help me to get a solution.
Thanks in advance.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 8월 19일
편집: Azzi Abdelmalek 2012년 8월 19일
a=rand(1,1000);
cii=cos([1 100:100:1000]),
x=bsxfun(@times,a,cii') % result = array 11x1000
  댓글 수: 1
SAZZAD HOSSAIN
SAZZAD HOSSAIN 2012년 8월 22일
Hi Azzi
You seem to have removed the codes for saving the arrays selectively. Could you please post that again.
Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Mani
Mani 2012년 8월 22일
create an array of the values you need at different locations eg : i=1:100: number_of_values
then create a new array to store them eg: for k= 1:length(number_of_values) req_values(k)= all_values(i); end

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by