Some number inputs do not work with code while others do.
    3 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Anne Nguyen
 am 7 Sep. 2019
  
    
    
    
    
    Beantwortet: Guillaume
      
      
 am 7 Sep. 2019
            For some inputs, the code works properly. But for example, if the number I put in for mass is greater than or equal to the number for acceleration, then the code does not work. What is wrong with my code? It says that the matrix dimensions must agree, but I do not know what that means. I am fairly new at MATLAB, so any help would be very much appreciated. Thank you! (Below is a pic of my code)
.png)
0 Kommentare
Akzeptierte Antwort
  Guillaume
      
      
 am 7 Sep. 2019
        You can see in your screenshot that both mass and acceleration are text not number. While you can indeed multiply two strings together in matlab, it doesn't make much sense (what is the product of 'abc' with 'def'?) and the strings much have the same number of characters.
In any case, you want numbers not text from input, so remove the 's' option from the two input calls.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!