필터 지우기
필터 지우기

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 CenterFile Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by