How to delete or exclude an entire matrix if it contains all zeros
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Caitlin
am 26 Jan. 2024
Kommentiert: Image Analyst
am 3 Feb. 2024
I'm reading a large data set where sometimes there is a matrix of all zeros in all rows and columns. How do I either delete the entire matrix of zeros after it has been read, or exclude MATLAB from saving it in the first place?
0 Kommentare
Akzeptierte Antwort
William Rose
am 27 Jan. 2024
@Caitlin, you'll have to be more specific about how you are reading in the data in order to get a useful answer.
X=zeros(10,10);
whos % show variables in the workspace
You can delete variable X with
clear X
whos
The output from whos shows that X is gone now.
4 Kommentare
Image Analyst
am 3 Feb. 2024
If this Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!