Creating variable In Maltab

2 ビュー (過去 30 日間)
rizwan
rizwan 2015 年 4 月 5 日
コメント済み: rizwan 2015 年 4 月 6 日
Hi Experts..
Sorry for this naive question..
I have max row and max column values for a variable ..i want to create a empty variable having dimensions max_row and max_col
I did this
mx_row = max(row);
mx_col = max(col);
cp = [mx_row ; mx_col];
but it creates a variable cp and store the values
Please help
Regards

採用された回答

Image Analyst
Image Analyst 2015 年 4 月 5 日
Not sure what you mean by empty, but if you mean all zeros, try this:
cp = zeros(mx_row, mx_col);
If you don't want zeros and truly want empty, then it's a contradiction if you want to use numerical arrays - you'd have to use a cell array like Azzi showed. But cell array's are complicated, especially for beginners, so if you want to use them, see the FAQ
  1 件のコメント
rizwan
rizwan 2015 年 4 月 6 日
Thanks Image Analyst
Regards

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

その他の回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 4 月 5 日
You can use cell arrays.
a=cell(4,5)

Jan
Jan 2015 年 4 月 5 日
"Empty variable" and "having dimensions max_row and max_col" is a contradiction. Please explain what you want to achieve.

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by