Borrar filtros
Borrar filtros

Can I Do These Kinds of Things In MATLAB, Or Is There Another Program That's Better For This?

2 visualizaciones (últimos 30 días)
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 comentarios
Stephen23
Stephen23 el 3 de Nov. de 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.
Patrick Faulkner
Patrick Faulkner el 3 de Nov. de 2020
Thank you so much for the link, Stephen! I've taken a look at it, and it looks like it's exactly what I'm looking for!

Iniciar sesión para comentar.

Respuesta aceptada

John D'Errico
John D'Errico el 2 de Nov. de 2020
Editada: John D'Errico el 2 de Nov. de 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.
  1 comentario
Patrick Faulkner
Patrick Faulkner el 2 de Nov. de 2020
John,
Thanks for the information! Can you explain, or perhaps provide links to the information, about how to go about doing this? I would be really interested in learning, but the classes I've had in college barely get past loops, only scratching GUIs, and the courses I'm taking on Udemy are making me more well-rounded, but don't seem to cover this topic either. So if it's short or simple, I'd be grateful for an explanation, but if it's a bit time consuming or hard to explain, I'd be happy to watch any video or read any series of web pages explaining the process.
Thank you again for your help!
Pat

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by