Effacer les filtres
Effacer les filtres

The operation or expression '(' has no effect

1 vue (au cours des 30 derniers jours)
Sarbajit Basu
Sarbajit Basu le 1 Avr 2021
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 commentaire
Rik
Rik le 1 Avr 2021
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.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 1 Avr 2021
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.)

Plus de réponses (0)

Catégories

En savoir plus sur Shifting and Sorting Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by