Array changes size every time I run the code
Mostrar comentarios más antiguos
Hi,
Im using matlab online and when I am running the code, the size/dimension of the array changes so that I get another error later in the code because the array need to be of a certain size.
The txt file is a array/list of float values with the dimensions: 99600x1. I have check the files in matlab by just opening them there and the dimension is correct there.
The problem is when I am running the code under, that the size of the arrays kx,ky,kz and ecg changes. And its not the same change every time. Sometimes some of the sizes are correct.
Anyone knows what is wrong?
Here is a image of an example. The sizes varies.

This is my code (I have also tried using readtable with a csv file instead):
kx = load("accx_mat_ex.txt");
ky = load("accy_mat_ex.txt");
kz = load("accz_mat_ex.txt");
ecg = load("ecg_mat_ex.txt");
ecgN = ecg/max(ecg);
k = kx+ky+kz;
kN = k/max(k);
whos
8 comentarios
DGM
el 20 de En. de 2022
Editada: Image Analyst
el 20 de En. de 2022
Attach the 4 files that demonstrate this behavior.
Vegard Iversen
el 20 de En. de 2022
DGM
el 20 de En. de 2022
I can't seem to replicate the problem. All the files consistently read with 99600 rows. I'm using R2019b.
Are these files being written immediately prior to being read, perhaps? It's not apparent why this would be happening. Maybe it's some sort of issue with the online version.
Alagu Sankar Esakkiappan
el 24 de En. de 2022
Hello!
I tried reproducing the issue both on R2021a offline as well as online version of MATLAB with the attached files and code sample, but couldn't reproduce the issue on both. Could you share some more details on the online Matlab version and check if uploaded data files in MATLAB online are the latest ones ?
Vegard Iversen
el 27 de En. de 2022
Alagu Sankar Esakkiappan
el 27 de En. de 2022
Hi!
Just to be sure, Can you delete the uploaded files in Matlab Online, re-upload them and try once more ? And please attach the screenshot of workspace editor after executing the above code after re-uploading.
Vegard Iversen
el 27 de En. de 2022
Vegard Iversen
el 27 de En. de 2022
Respuestas (1)
Cris LaPierre
el 27 de En. de 2022
Editada: Cris LaPierre
el 27 de En. de 2022
0 votos
Please contact support to report this. Be sure to include that this is only happening in MATLAB Online.
Categorías
Más información sobre Data Import and Export en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
