Input matrix for scenarios

I have a set of scenarios say 1,2,3. And each scenario has a set of zero-one matrices showing if an arc has failure or not. for example: scenario 1 will have [1,1,1;0,1,1] and scenario 2 will have [1,0,0;0,1,0].( 1 representing no failure and 0 representing failure) I dont know how to write it on matlab. I would be grateful if anyone of you could help me out with it.
Thankyou!

 採用された回答

Image Analyst
Image Analyst 2013 年 5 月 28 日

0 投票

What do those 2 row by 3 column matrices represent? Why can't you just do
scenario1 = [1,1,1;0,1,1];
scenario2 = [1,0,0;0,1,0];
and the same for scenario3? It seems so obvious that I must be missing something.

4 件のコメント

jana
jana 2013 年 5 月 28 日
I would need the scenario numbers for the for loop that I am using for my code. I was thinking of creating a 3-D matrix but I am not sure how to do it.
Image Analyst
Image Analyst 2013 年 5 月 28 日
That would be better. Two ways:
scenarios = cat(3, [1,1,1;0,1,1], [1,0,0;0,1,0], [1,1,1;1,1,1]);
Or:
scenario(:,:,1) = [1,1,1;0,1,1];
scenario(:,:,2) = [1,0,0;0,1,0];
scenario(:,:,3) = [1,1,1;1,1,1];
jana
jana 2013 年 5 月 28 日
Thank you!, that really helped!
Image Analyst
Image Analyst 2013 年 5 月 28 日
If we're done, then go ahead and mark it Accepted.

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

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 5 月 28 日

0 投票

A=[1,1,1;0,1,1]

Community Treasure Hunt

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

Start Hunting!

Translated by