Loading a zero array without setting as "empty"

3 visualizaciones (últimos 30 días)
SteveM
SteveM el 9 de Feb. de 2024
Comentada: Stephen23 el 9 de Feb. de 2024
Hi,
I am reading a data array (Data_Input) approx 32000 x 24 into 24 seperate arrays for easy plotting.
Firstly, I initialize each target array: (just one shown for simplicity):
app.Data1=zeros(number_of_rows,1,'double');
app.Data1 = app.Data_Input(:,4); This loads the 4th column from Data_Input into app.Data1, and works fine!
However, the problem is when app.Data_Input(:,4) (i.e. the 4th column) is full of zeros.
Then, instead of the initialized app.Data1 "zeros" matrix, I now have app.Data1 = empty !
This completely confuses my later APP software as it can't extract the "0" values from specific rows.
So how can I prevent a nicely formatted zeros matrix being converted to an "empty" matrix?
Please help,
Thanks
  5 comentarios
Dyuman Joshi
Dyuman Joshi el 9 de Feb. de 2024
"I want seperate matrices as I need to perform other operations solely on one column."
That can be done via indexing as well.
"... runs faster if split into 24 separate matrices at the start."
I doubt that.
A simple approach would be to read the data, perform the operation on that particular column and then plot accordingly.
As I mentioned above and is explained thoroughly in the link I attached, splitting data into separate matrices is not considered to be a good idea.
Stephen23
Stephen23 el 9 de Feb. de 2024
app.Data1
A cell array with indexing would still probably be better than 24 fields with pseudo-indices in their names.
@Dyuman Joshi: the code in the OP's question does not show 24 separate variables in the workspace (but apparently has 24 different fields of some app), so my tutorial is not directly related.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Logical en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by