Community Profile

# Tariq Hammoudeh

Last seen: 4 months ago Active since 2021

#### Content Feed

View by

Question

how to add numbers above the tips of a bar chart
I have an array b=[ 1 2 3] then i use bar(b) now how can i write the value of each bar (so the elements of the array) over e...

4 months ago | 1 answer | 0

### 1

Question

How can I make randi() in a loop not choose the same number
I have an array x=zeros(1,36) then i have inside a while loop: while .... y=randi(length(x)); z=randi(length(x)); How c...

4 months ago | 1 answer | 0

### 1

Question

detecting elements change in an array
I have an array of zeros: x=zeros(1,36); and in my program i change some elements of it to 1 using for example x(6)=1; N...

4 months ago | 2 answers | 0

### 2

Question

Im using randsample() but im getting an error
Im using randsample to make the program choose a random element from an array, A=[2 3 4 5]; random=randsample(A,1) but im ...

4 months ago | 1 answer | 0

### 1

Question

How can I loop an if statement
Im designing a game of battleship and I have the following code to prevent ships from overlapping. x=zeros(1,36); starting...

4 months ago | 0 answers | 0

### 0

Question

I have a gridded figure with 2 "game boards" , but they don't look the same
I have the following code to plot a figure with 2 game boards, for a battleship game: subplot( 2, 1, 1 ); set( gca, 'XTick...

5 months ago | 1 answer | 0

### 1

Question

Im designing a game of battleship, but. im trying to use a code to prevent the user from placing a ship out of bounds
in my game of battleship the board is 6 by 6, so when the user wants to place a (1X2) ship on grid 6 and chooses a horizontal or...

5 months ago | 2 answers | 0

### 2

Question

Problem with an if statement
I have this code: orientation= input (' enter v or h') if orientation == v ...... end but whenever i run the code and e...

5 months ago | 1 answer | 0

### 1

Question

I have this function but whenever I call it using its name, I get an error
I am building a game of battleship, and i have this function to create a figure for the boards. now when ever i try to ...

5 months ago | 1 answer | 0

### 1

Question

how can I plot a game board in a figure
Im programming the game battleship, and i need create a figure 2, 6 by 6 boards (one for the user and one for the computer). I w...

5 months ago | 1 answer | 0

### 1

Question

How can I make the program count the number of decimals of an inputted amount
I have this code: withdrawAmount = input ('Enter amount to Withdraw '); . . . . . Is there anyway the program could cou...

5 months ago | 3 answers | 0

### 3

Question

how to use a while loop for switch case
I have this code: transactionType= input('1:withdraw 2:deposit 3:account balance 4:end use'); switch transactionType case ...

5 months ago | 2 answers | 0

### 2

Question

getting a number from a text file
I have txt file with 1 number inside only, nothing else. is there a way to get that number as a variable so that i can use an i...

5 months ago | 0 answers | 0

### 0

Question

how to use ismember() to check if an inputted number exists in a matrix.
I have a csv file named "NaiveBankData.csv" (attached) and i imported it, then read it as a matrix, but now how can i check if a...

6 months ago | 1 answer | 0

### 1

Question

I'm using textscan to read in a csv file, but when I check the variable its incorrect
im trying to read in a csv file(attached) using the code below, but then when i click on the variable from the workspace I don...

6 months ago | 2 answers | 0