Can I Do These Kinds of Things In MATLAB, Or Is There Another Program That's Better For This?
4 views (last 30 days)
Show older comments
Patrick Faulkner
on 2 Nov 2020
Commented: Patrick Faulkner
on 3 Nov 2020
Hi,
I am working with theoretical data for a personal project, and I have some questions about MATLAB's capability. I am testing the known properties of square matrices, and I wanted to ask if MATLAB could handle/create any sort of data (variable, matrix, etc) which was more than two dimensions. By that I mean, when you tell MATLAB that a = 2, a is stored as a matrix of 1x1 size. Could I make a cubed matrix in MATLAB that was 1x1x1, or a four-dimensional matrix that was 8x8x8x8? I am not so concerned with the "how" to accomplish a data group like this, I just was interested in creating some functions which would deal with these sorts of extended matrices, with the same rules that we handle the multiplication of [2x3] x [3x2] sorts of problems.
On a related note, aside from writing a function, is there anyway I could make up my own data type and tell MATLAB what to do with it, like inventing my own type of math and giving MATLAB the rules to play by? I'm a new learner, and I really want to test what all I can do with this program. If this isn't something I can do with MATLAB, but it is something I could do with another programming language, I'd be really interested in that information as well!
Programmer Pat
2 Comments
Stephen23
on 3 Nov 2020
Could I make a cubed matrix in MATLAB that was 1x1x1, or a four-dimensional matrix that was 8x8x8x8?"
Scalars, vectors, matrices, empty arrays, etc. are all just different sizes of the same array types, there are no special types you need to learn about. You can define as many non-singleton dimensions as you wish, all arrays implicitly have infinite trailing singleton dimensions.
Accepted Answer
John D'Errico
on 2 Nov 2020
Edited: John D'Errico
on 2 Nov 2020
Can you do it with MATLAB? Of course. MATLAB allows matrices with any number of dimensions. In fact, a scalar is really a matrix with dimensions 1x1x1x1x1x1x1... out as far as you can see.
Can you invent your own data type? Of course, I've done it several times, in fact, at least a half dozen. Three of mine are posted on the file exchange for others to use.
Could you do the same things in other languages? Of course. A lot of this is a question of your skill at programming, and your understanding of the problem you wish to solve, not the language itself.
Is there some best possible language to do something like this? Not really. Again, your skill in use of the language is more important.
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!