I’m trying to get a matrix a by b. However I get an error with the below code.
The errors occur on the line
NV(b,:)=(a;b);
errors are:
invalid syntax at “,” or missing ), ]
and parse error at “)”
This is the code:
n=2;
g1= 1:1:10;
g=10.^(g1/10); %SNR
for a= 0:g %diff SNR
for b= 1:n %DIFF USERS
NV(b,:)=(a;b); % NOISE VAR, MATRIX FOR DIFF SNR AND DIFF USERS.
end
end
What might cause these errors and how do I solve them?
thanks
NV is not defined before you try to access all elements of the second matrix dimension. That is essentially saying “set all of an unknown quantity”–it could be one or it could be infinity. It is not a well formed statement.
The rest of that line is a little odd too and not valid syntax since it looks like you’re trying to create an array of arrays.
I’m not positive exactly what you’re doing (how big is the second dimension of NV supposed to be and whether or not my correction of “NV(b,:)=[a;b];” is what you intended), but this syntax compiles/runs and hopefully gets you started in the right direction.