concatenate matrix with zeros function
Mostra commenti meno recenti
if I have matrix a = [2 3 4; 5 6 7; 8 9 1],
zeros = (a, 2)
is this a valid code? because one of my working code has this. if so how does the output look like ?
7 Commenti
Matt J
il 15 Giu 2022
if so how does the output look like ?
Can't you tell by running it?
Ashis Pandey
il 15 Giu 2022
Ashis Pandey
il 15 Giu 2022
Ashis Pandey
il 15 Giu 2022
Modificato: per isakson
il 15 Giu 2022
KSSV
il 15 Giu 2022
What you want to do? What exactly is your question?
Ashis Pandey
il 15 Giu 2022
per isakson
il 15 Giu 2022
Modificato: per isakson
il 15 Giu 2022
Let me guess. The value of ants_pairs.Length is a scalar. The word, Length, supports that. The value of a is a 2D array. See zeros.
zeros([2,3],4)
Risposte (1)
The code "TxRxPairs = zeros(ants_pairs.Length,2)" is correct. It has the function name "zeros" followed by the arguments inside the brackets. The first argument "ants_pairs.Length" is a scalar rather a vector or matrix.
> In short, if I have matrix a = [2 3 4; 5 6 7; 8 9 1],
> zeros = (a, 2)
The statement of "zeros = (a, 2)" is wrong. First, the correct stament should be function name (zeros) followed by arguments inside brackets, say
% x = zeros(a, 2) % wrong
Even the above is still not correct, as a is not a scalar. So the correct statement should be
a = [2 3 4; 5 6 7; 8 9 1];
x = zeros(size(a)) % where size(a0 = [3 3]
The above is correct in syntax. But we don't know if it is what you want.
You can also have:
y = zeros(a(1,1), 2) % where a(1,1) is a scalar
Categorie
Scopri di più su Creating and Concatenating Matrices in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!