Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
why the error occur when i use horzcat fuction
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/302798/image.png)
the error message ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/302803/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/302803/image.png)
the output from y is matrix [2,3]
then i take only the first element
rr=4;
the output must be rr=[4,2,3]
0 Commenti
Risposte (1)
Geoff Hayes
il 27 Mag 2020
Shehab - are you sure that the y is a 1x2 array like [2,3]? Or is it a 2x1 array like [2,3]'? If the latter, then you are trying to horizontally concatenate a 1x1 scalar with a 2x1 array and so the error makes sesne. From find, this function returns a vector with the same orientation as the input array. And your input at
y = find(a(iu) == matrix(:, i))
suggests that it is a column array/vector since you are comparing against the ith column of matrix. Use the MATLAB debugger to step through the code to validate this.
1 Commento
Image Analyst
il 27 Mag 2020
Before the horzcat line, put this
whos rr
whos y
What do you see in the command window? Do they both have the same number of rows?
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!