Class Property Validation for the Contents of a Cell Array Property?
    11 次查看(过去 30 天)
  
       显示 更早的评论
    
I'm writing a class that stores its data in the form of cell arrays, matching values to their units. An example property definition might look something like:  
classdef myClass
    properties (SetAccess = private)
        prop1     (2, 2) cell = { 1000, "m" ; 1, "km" }
    end
end
In the class definition, I'd like to use property validation to restrict the values in column 1 to valid distances, nonnegative for example, and column 2 to valid strings that define an actual unit type, "m"/"ft"/"in" for example. This is trivial for defined types, like 'int16' or 'double', but I'm wondering if anyone has accomplished this for columns/rows inside a cell array. The goal here is to store property value with its unit, while also restricting both to valid input. Is this possible given the cell type at property definition? Thanks!
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Argument Definitions 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!