Removing Rows from Character Vector?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Justin Alexander
il 20 Giu 2019
Modificato: Justin Alexander
il 20 Giu 2019
The character vector Materials is a single column, 40 row vector with the names of the necessary materials.
The numeric vector Inventory is a single column, 40 row vector with the amount of each material in stock.
The numeric vector Needed is a single column, 40 row vector with the amount of each material we require.
The numeric vector Defecit is a single column, 40 row vector with the amount of each material we lack.
In order to parse down the final product to show just the rows of materials that we need to order, I wrote the following bit of code
DF = all (Deficit > 0 , length(Deficit)) %DF is a column vector the same length as Deficit that has a 1 if we need to order, a 0 if we do not.
DefecitFinal = Defecit(DF,:) %Similar code for the other numeric vectors to provide just the rows that we need to order
MaterialsFinal = Materials(DF,:) %Provides an error message
I feel like theres a really simple way that i'm just not familiar with to adjust the Materials data as well.
2 Commenti
KALYAN ACHARJYA
il 20 Giu 2019
Please explain the question in simple maths way, not as per your subjects.
What you have?
What result you are expecting?
Risposta accettata
Più risposte (0)
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!