I need to get a data value of a 1X2 array and print it on the screen.
9 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Adrian Van den boom
2021 年 9 月 7 日
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.
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
