How do you create a matrix of matrices in a method?
이전 댓글 표시
I'm trying to design a class whose instance is an array of matrices. The matrices are read from some source file, xls, csv, etc. The super matrix is of size 30, and the user can add files in each slot. The declaration needs to allow for dynamic possibilities. But I'm not sure how to do this syntactically. I'm running MATLAB R2012B.
Here is the code thus far:
classdef BankAccount < handle properties (Hidden) end
properties (SetAccess = private)
VEC
IndicatorCount = 0;
Index = zeros(30); %This obviously won't work because of a dimension mismatch
end
methods
function BA = BankAccount(filename)
if nargin ~=0 %handles empty declarations
BA.VEC = xlsread(filename);
BA.IndicatorCount = FI.IndicatorCount +1; %find shorthand
disp(FI.IndicatorCount)
BA.Index(FI.IndicatorCount)= FI.VEC; %need the Index to be able to take on %different matrix sizes dynamically
end
end
end
end
if someone can tell me how to do this in a smart way I would appreciate the help
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Construct and Work with Object Arrays에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!