Read in Cell Array that contains cell arrays from a File.

조회 수: 1 (최근 30일)
Dreamer
Dreamer 2015년 9월 18일
편집: Stephen23 2015년 9월 18일
Hi,
I am trying to read a cell array structure from a file into a cell array in Matlab.
Eg. Data in File: {{x,y};1;2}
The problem is that Matlab will obviously treat this as a string. Is there any way I can read in the contents into a cell array from the file?
My end objective is to create an external application that outputs a file in this format with different data. There is a function that another person in Matlab created to read in a cell array of with the first column also a cell array.
Kind Regards, Dreamer
  댓글 수: 3
Dreamer
Dreamer 2015년 9월 18일
Please see edit to my post above.
Stephen23
Stephen23 2015년 9월 18일
편집: Stephen23 2015년 9월 18일
Your question is not clear, and you didn't explain how x and y should be interpreted.
Please give us exact examples of the file data and what you want MATLAB to do. Explanations without input and output data for us to try are not very useful.
It is likely that using a .mat file would be the simplest solution, have you tried using one?

댓글을 달려면 로그인하십시오.

답변 (1개)

Adam
Adam 2015년 9월 18일
편집: Adam 2015년 9월 18일
What kind of file are you talking about? The only type of files I am aware of that can store cell arrays are .mat files. From what you are saying I assume you mean you have some kind of text file that includes all the { formatting.
Functions like textscan will naturally read file contents into cells using a format you specify so you can probably play around with that, maybe with the addition of some string manipulation functions to read the data in as you want. It would be easier to read such data into cells if it didn't have all the {'s and }'s in the file though probably.

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT Files에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by