2

Do not get confused with row numbers in the arrays. I am just asking converting 1 into style 2

This is Cell Array C

cell array 1

I want to convert it to the below version how can i do that ?

V2 =

cell array 1 converted to v2 enter image description here

0

1 Answer 1

2

If I understand correctly, you have a flat cell array of strings (which contain valid MATLAB cell array definitions), and you want to convert each string into a sub-cell-array of its own. So what you need is:

cellfun(@eval, C, 'UniformOutput', false)

Where C is the original cell array of strings.

Example:

C = {'{''samsung'', ''n150'', ''jp0xtr'', ''n570''};'; ...
    '{''samsung'', ''n150'', ''jp0xtr'', ''beyaz''};'}
C2 = cellfun(@eval, C, 'UniformOutput', false)

The result is:

C = 

    '{'samsung', 'n150', 'jp0xtr', 'n570'};'
    '{'samsung', 'n150', 'jp0xtr', 'beyaz'};'


C2 = 

    {1x4 cell}
    {1x4 cell}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.