Coco, if you read David's explanatation in the old thread I quoted (https://thegrammarexchange.inf...c/what-is-the-matter), you'll see that "what's the matter" is an idiom, that is, a set phrase whose components always remain in that position, even in reported speech: He wants to know what is the matter with her; I asked him what was the matter with him.
Leaving aside that case as an exception, subject and subject complement will be defined by the position the reply to "what" (also "who" or "which") occupies in the answer to the question.
- What's wrong with you? (Something is wrong with you. -> here "what" is the subject, because "something" occupies the place of "what" in subject position)
- I want to know what is wrong with you.
- What's the problem with you? (much less usual than "What's the matter with you?") (The problem with you is that you look worried. -> here "what" is the subject complement, because "that you look worried" occupies the place of "what" as a subject complement in the answer)
- I want to know what the problem with you is.