Irregular Arrays for fixed.Interval Objects
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Michael McCreesh
am 22 Sep. 2022
Kommentiert: Michael McCreesh
am 22 Sep. 2022
Hi,
I am working on code in which I am constructing an interval of valid inputs and I have been using fixed.Interval objects. My code involves taking the set difference between intervals and this is resulting in having irregular-sized objects in the following manner (example with basic numbers):
% Initial Valid Inputs
valid = fixed.Interval([1;3],[2;4])
% Invalid Inputs
invalid = fixed.Interval([1.4;3.5],[1.6;4])
% Valid Inputs in First Variable Once Removing Invalid
valid_hold1 = setdiff(valid(1),invalid(1))
% Valid Inputs in Second Variable Once Removing Invalid
valid_hold2 = setdiff(valid(2),invalid(2))
Now, the issue is my two valid interval sets are 1x2 and 1x1 since in the one variable the valid inputs are now split into two intervals. As such the intervals can not be concatenated into a single fixed.Interval object in order to be returned. Of course, at such a small scale simply doing individual variables would be fine, but I need to expand it to an arbitrary number of variables. I thought of using a cell array, however fixed.Interval objects do not fit in cells. Does anyone have an idea on a way to solve this problem?
0 Kommentare
Akzeptierte Antwort
dpb
am 22 Sep. 2022
Never heard of them, but never used/don't have the FixedPoint TB ... all my micro work occurred way before any of these toolsets existed...
Anyways, not sure how you tried it and why concluded a cell array doesn't work, but at least the brute-force way seems to...
valid = fixed.Interval([1;3],[2;4]);
invalid = fixed.Interval([1.4;3.5],[1.6;4]);
% Valid Inputs Removing Invalid
valid_hold=arrayfun(@setdiff,valid,invalid,'uniform',0)
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!