Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Problem when creating a new class

조회 수: 1 (최근 30일)
Stéphane
Stéphane 2015년 11월 18일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi all, I've created a class "experiment" with the constructor "experiment(obj,folderList)" and the property "folder". I would like the constructor to return an object of length 1 with obj.folder = folderList when the size of folderList is 1, and an object of length n when there are n folders in folderList... with obj(i).folder = folder{i}.
It works fine with one folder in the list, but when I do in the constructor :
for i=1:numel(folderList)
obj(i).fodler = folderList{i}
end
It seems the constructor calls itself... I guess it's the expected behaviour, as I'm creating a new object each time, but I'm wondering if there is a way to do what I want...
Thanks
Stéphane

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by