I need to get a data value of a 1X2 array and print it on the screen.
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a 1 by 2 array with two values stored from a previous calculation.
How do I access them?
Can I use a fprintf to display them in the command window?
0 comentarios
Respuestas (1)
Adrian Van den boom
el 7 de Sept. de 2021
Open MatLab and fill this in in your command window:
x = [1 2] % Create a one-dimensional array of length 2
x(1) % Now get the first item of the array
ans = 1 % This is the answer you get after hitting enter
Just go through the MatLab onramp course, that'll get you going with the MatLab syntax. It's full of how to work with arrays and matrices.
3 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
