필터 지우기
필터 지우기

How can I pre-allocate an array of VideoWriter Objects?

조회 수: 1 (최근 30일)
Chris Bell
Chris Bell 2017년 10월 26일
댓글: Chris Bell 2017년 10월 26일
I would like to pre-allocate an array of VideoWriter Objects. I don't know how many I will want. I can do it in a loop, but Matlab moans at me :-). Is there any way to do this please?
  댓글 수: 2
Looky
Looky 2017년 10월 26일
You cannot preallocate an array if you don't know how many elements your array is supposed to have!
If you have this information, preallocation for objects means to write default objects into your array. You can do this by replicating the first used object with repmat to the size you want your array to have. (Alternatively if the object class supports a default constructor you can tell matlab to use this instead. See Here However, this is not the case for VideoWriter Objects)
I would suggest that you ignore matlab here. If you don't come up with a huge number of those VideoWriter Objects, this shouldn't be an issue for your program.
Chris Bell
Chris Bell 2017년 10월 26일
Sorry, bad English. Should have said it will be a variable number of VideoWriter obects for each time I run the program. I will know how many by the time I am creating them.
You are right; for what I want it won't be a problem. I was just being pedantic and trying to get rid of as many orange bars as possible. Thanks for your help

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by