How to write a matrix using for loop

I want to create a matrix that contains points as x and y coordinates. like this :
A=[1111222233334444
1234123412341234]
it has to be like this and i want to create this using for loop . Is there any way to do so ?

2 件のコメント

Steven Lord
Steven Lord 2019 年 3 月 14 日
If you show us what you've tried so far we may be able to offer some guidance for how to improve or correct that code.
Shahrukh Hossain
Shahrukh Hossain 2019 年 3 月 16 日
clear all;
close all;
clc
for i=1:10
x=ones(1,10)*i;
y=1:10;
a=[x;y]
end
a
If you run this code, you will see that it gives me [1111111111;12345678910]. then on the next loop it gives [222..... ; 1234....] you get the idea. Now I am looking for a way to keep this values in to one single matrix at the end of the loop. Like this :
a=[111111111122222222223333333333.......10
123456789101234567891012345678910......]
these are xy coordinates. Can you help me do this ?

サインインしてコメントする。

回答 (2 件)

Matt J
Matt J 2019 年 3 月 14 日

2 投票

Yes.

5 件のコメント

Shahrukh Hossain
Shahrukh Hossain 2019 年 3 月 14 日
Okay., do you know how ?
Matt J
Matt J 2019 年 3 月 14 日
Yes, I know how.
Shahrukh Hossain
Shahrukh Hossain 2019 年 3 月 14 日
can you please show me
Matt J
Matt J 2019 年 3 月 14 日
編集済み: Matt J 2019 年 3 月 15 日
Since it is homework, you have to explain to me how I can help you short of doing the whole thing.
Shahrukh Hossain
Shahrukh Hossain 2019 年 3 月 14 日
Thanks for your great help . Appreciate it !!!

サインインしてコメントする。

TADA
TADA 2019 年 3 月 16 日

0 投票

I would start at the documentation

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

製品

リリース

R2013b

質問済み:

2019 年 3 月 14 日

回答済み:

2019 年 3 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by