MATLAB Matlab class array / other array

Click For Summary
The line of code snleg = strtrim(cellstr(num2str(alf_deg.'))); is used to convert a transposed numeric array alf_deg into a string format while removing any leading or trailing whitespace. The num2str function converts numeric values to strings, which is necessary for further processing as strings. The cellstr function then converts these strings into a cell array format, allowing for easier manipulation in MATLAB. Finally, strtrim cleans up the resulting strings by eliminating unwanted spaces. Understanding these functions is crucial for effectively handling data in MATLAB.
K41
Messages
94
Reaction score
1
Okay so what does this line of code mean:

snleg = strtrim(cellstr(num2str(alf_deg.')));

I did some research and it is ultimately removing whitespace (comma's, spaces etc) from a file scanned in, but I don't understand the argument of the function.

I don't understand what cellstr is or num2str. I read that it might be to do with cell arrays and they can't or can be modified? I am very confused :sI imagine num2str converts a number to a string value but why do we need to do this?

Please note, alf_deg was a variable already initialized in the code. Why do we need a .' in here?
 
Physics news on Phys.org

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 11 ·
Replies
11
Views
4K
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
13K