create 3-dimension matrix

5 views (last 30 days)
fatema saba
fatema saba on 1 Jan 2015
Commented: fatema saba on 1 Jan 2015
A Question please.
I want to write a function that create a 3-dimension matrix based on two 2-demnesion matrices.
I named this new matrix C.
I write something but when I run it give me "ans" but I want to give me matrix C.
this is my simple code
function Model=Base()
%z1=[90 50 159;148 120 31;142 3 74];
%z2=[13 155 108;141 40 102;109 119 144];
for k=1
for k=2
What is rong in my code please?
Thank you

Accepted Answer

Shoaibur Rahman
Shoaibur Rahman on 1 Jan 2015
If you use your current code, then call your function create1() (from command window, or in another m-file):
c = create1();
This will show c in your workspace as a struct.
But if want to see c as double instead of struct, then modify the last line of your code. Replace Model.c=c by Model = c
Then type c = create1() in your command window, which will show c in the workspace.
fatema saba
fatema saba on 1 Jan 2015
Thank you and all the other friends

Sign in to comment.

More Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 1 Jan 2015
fatema saba
fatema saba on 1 Jan 2015
no I have done but..
>> Model
??? Undefined function or variable 'Model'.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!