フィルターのクリア

The operation or expression '(' has no effect

1 回表示 (過去 30 日間)
Sarbajit Basu
Sarbajit Basu 2021 年 4 月 1 日
回答済み: Walter Roberson 2021 年 4 月 1 日
Hello all,
I wrote this code to generate multiple sheets having different 5*5 matrices. Somehow, my array ends up empty.
BingoShtGen generates a 5*5 array.
clc
clear all;
numSheets=20;
BngoSt=zeros(6,5,20);
for i=1:numSheets
BngoSt(1,1,i)=701;
BngoSt(1,2,i)=702;
BngoSt(1,3,i)=703;
BngoSt(1,4,i)=704;
BngoSt(1,5,i)=705;
end
for i=1:numSheets
BingoShtGen
bSt;
for iC=2:6
for jC=1:5
BngoSt(iC,jC,i)=bSt(iC-1,jC);
bSt(iC-1,jC);
BngoSt(iC,jC,i);
end
end
BngoSt(:,:,i);
tt=isempty(BngoSt);
bSt
tt
44;
end
tt=isempty(BngoSt);
tt;
  1 件のコメント
Rik
Rik 2021 年 4 月 1 日
If you have trouble with Matlab basics you may consider doing the Onramp tutorial (which is provided for free by Mathworks).
Unless BingoShtGen is a script, you aren't actually doing anything with the output. Also, unless bSt is a function, the second line in the inner loop doesn't do anything.

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

採用された回答

Walter Roberson
Walter Roberson 2021 年 4 月 1 日
We cannot tell whether bSt is a function or a variable. If it is a function then you call it once with two parameters and once with no parameters. If it is an anonymous function then you call it once with two parameters but another time just ask to display the formula. If it is a variable then you do not initialize it.
This is important because if you are initializing it inside a script BingoShtGen then current versions of MATLAB may not know that it is being created inside the script. If you are writing into it inside the script, then at some point before you call BingoShtGen you need to assign something to bSt in order for MATLAB to recognize that it is intended to be a variable (that might be changed inside a script.)

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by