Hello, I want force user input exactly 3*4 matrix. other size is unacceptable.

 Akzeptierte Antwort

James Tursa
James Tursa am 17 Feb. 2017

0 Stimmen

x = the user input
if( ~isequal(size(x),[3 4]) )
error('Size must be exactly 3x4')
end

2 Kommentare

Guillaume
Guillaume am 17 Feb. 2017
Bearbeitet: James Tursa am 17 Feb. 2017
or
validateattributes(x, {'numeric'}, {'size', [3 4]})
James Tursa
James Tursa am 17 Feb. 2017
+1 Guillaume

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Gefragt:

am 17 Feb. 2017

Bearbeitet:

am 17 Feb. 2017

Community Treasure Hunt

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

Start Hunting!

Translated by