Question in creating variables.

How do i create variables in each iteration? like x_1 to x_n and then assigning values/arrays to each of them.

댓글 수: 4

Andrei Bobrov
Andrei Bobrov 2012년 9월 30일
doc for
Matt J
Matt J 2012년 9월 30일
I think you already asked this question (and got satisfactory answers) here:
Portgas Ace
Portgas Ace 2012년 9월 30일
not answered. :( because i have to show 'A1' , 'A2', 'A3' to 'An' in my output. which will be determined depending on the initialization.
Portgas Ace
Portgas Ace 2012년 9월 30일
output should look like this
A1---------3---------5---------6
A2---------5---------3---------4
A3---------6---------7---------9
(sorry for using -, spaces dont work)

댓글을 달려면 로그인하십시오.

 채택된 답변

Matt J
Matt J 2012년 9월 30일

0 개 추천

I would do something like this:
labels=arrayfun(@(i) ['A' num2str(i)], 1:3,'uni',0).';
data=cellfun(@(a) num2str(a), num2cell(A),'uni',0);
result=[labels, data]
result =
'A1' '3' '5' '6'
'A2' '5' '3' '4'
'A3' '6' '7' '9'

댓글 수: 1

Portgas Ace
Portgas Ace 2012년 9월 30일
thank you :D ive done something simple to understand but a bit longer.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2012년 9월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by