MATLAB to Excel Translation.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
N/A
el 9 de Mayo de 2019
Comentada: N/A
el 12 de Mayo de 2019
Good day,
I need help figuring out whats wrong with the code. Attached are the files required.
So the goal of the code is to translate any imformation from the attached image and input data collected into an excel file but for some reason, I have a problem with the transferring of data from MATLAB to Excel.
Any help would be appreciated.
Thank you.
0 comentarios
Respuesta aceptada
Walter Roberson
el 9 de Mayo de 2019
You grow numbers by one row for each subblock. Your line 68 extending numbers would fail of the number of digits in length(B) changed. You are constructing a char column vector that is mostly '0' characters, it appears.
Then each subblock, you write out all of the accumulate numbers to the rectangular area A1:AN40 even though it is only one column.
Ah... looking more closely that is not quite right. You initialize
number = [];
and later
numbers = [number ; num2str(length(B))];
This does not grow the array. You initialized number (no trailing 's') to [] so numbers (with trailing 's') will always become just num2str(length(B)) which will be a single character vector. And that is what you write out over all of A1:AN40 each time.
To accomodate different lengths you should be using a cell array of character vectors. For efficiency you should pre-allocate it to have the same number of elements as ca has. And you should leave the xlswrite() until after the nested for loops.
You should also pay more attention to all of those imshow() you have. They are erasing one another inside the same subplot, which is an expensive operation (image() instead of imshow() would do less in that regards.) There is no point in plotting those things only to erase them and immediately plot over them, since they will never be visible. Just plot the final image and the count.
7 comentarios
Walter Roberson
el 12 de Mayo de 2019
Okay, since you don't really care about the display, I have enclosed a modified version that should handle the Excel part.
This version does not place some of the sub-images properly on the display, but is much faster than using subplot(). Since it is not the display you are interested in, there is no point in my getting the display perfect: this should be enough to show you that the analysis is working.
Note that this produces two figures. You were producing some images and writing over them and you produced a final image at a particular location which did not make any sense considering everying else being done, so I put that stuff into a separate figure. You will need to look for it specifically as it will be hidden behind the full-screen display of the sub-images.
Más respuestas (0)
Ver también
Categorías
Más información sobre Computer Vision with Simulink en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!