¿how can I show a matrix of type -cell- in a msgbox?
2 次查看(过去 30 天)
显示 更早的评论
I annoy them with another great concern that I have. I'm doing a program in which we must show matrices with numeric and non-numeric characters (letters); I am putting these matrices in matrixes of the cell type. What I want is to show these matrices in messages - msgbox -, and try to put them directly (as would be done with a numeric matrix type double) but I get errors, and try making use of several commands like -str2double- and several more, but not I get the matrix to appear in an organized and neat way. Could someone help me with this matter?
I leave a piece of the code, this piece contains one of my matrices that I want to show in -msgbox -
Note: My arrays are not of constant dimensions.
for f=1:NP
[Pos_GL_Y1] = find( NodosT (:,2) == NodosT1(f,1) );
[Minx_piso,Pminx]= min( NodosT( Pos_GL_Y1,1 ) );
Zi (:,f) = abs( Coe_par(f,1) )* M_Sd(f,1); % desplazamientos
Zi_c (:, f) = [ num2cell( Zi (:,f) ) ; ['Mod',num2str(f)] ] ;
Yp(1:NP, f)= Modos (:,f)*Zi(1,f);
Yp(f, 4)= NodosT ( Pos_GL_Y1 (Pminx,1) , 3 );
Yp_c (:, f) = [ num2cell(Yp(1:NP, f)) ; ['Mod',num2str(f)] ] ;
Yp_c {f, NP+1} = ['U ',num2str( NodosT ( Pos_GL_Y1 (Pminx,1) , 3 ) )] ;
menospiso=menospiso+1; % BORRAR
end
![cell.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/226331/cell.png)
As shown in the image, I want my matrix "Yp_c" to be seen in a msgboxmsgbox.
Thank you very much for your help.
1 个评论
Jan
2019-6-26
"put them directly (as would be done with a numeric matrix type double)" - What does this mean?
"I get errors" - Then please post the code with some inputs and y copy of the complete error message.
"not I get the matrix to appear in an organized and neat way" - The readers cannot guess, what you call "neat and organized". The screen shot is a hint, at least.
"this piece contains one of my matrices that I want to show in -msgbox -" - We cannot run the code due to missing inputs. It is not clear, which array you mean.
采纳的回答
Shameer Parmar
2019-6-26
Hello Pedro Guevara
I understood your problem, but I dont know the axact value of matrix 'Yp_c' because it is not properly visible in your questions.
So I took reference of another matrix 'Ys_c' (7 by 4) and creaetd logic here for you.
So you can apply this logic to your matrix by replacing it with actual values.
See attached code... You can modify it as per your requirement.. Thanksss..
3 个评论
Shameer Parmar
2019-6-27
NO matter of any matrix.. here you can copy my code from line #18 to the end and replace the matrix 'Yp_c' with your matrix name and see the results... You can adjust the code is the output message is not displaying properly..
Please try for this..
If you are still facing issue, then provide me your input files and tell me the expected results.. I can ready to help you.. Good Luck..
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Identification 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!