Message Boards Message Boards

GROUPS:

Mathematica 9 Iterative Import

Posted 6 years ago
6141 Views
|
4 Replies
|
0 Total Likes
|

Hello!

This was the original question

I have been trying to make an iterative scheme to name a set of indexed variables to a set of indexed strings. Earlier in the document I have code which automatically exports based on a similar iterative scheme in order to have the code be flexible to the parameter lmax. This way I can automatically export data under different file names based on this parameter. Now I want to import this data and name it to a variable. I have tried many different ways, and attached is the most recent way I tried with its failure. I am failing to see the actual problem. It seems like Import is reading the literal name of the variable as opposed to its assigned value. I tried using x:= instead, but then the string gets named with "lmaxi" instead of "lmax19" or "lmax20".

I am going to continue working on this, but I am a novice and I am hoping that someone more experienced may see the problem quicker than I do.

Thank you for your time

Now I am seeing more of the problem. The x[i] are a string, but import is having a problem recognizing that. I post this just in case someone can figure it out before me. I am on pursuit to the solution!

Thank you for your time :)

Attachments:
4 Replies

P.S. This is not an actual homework assignment. I know the path makes it seem that way, but it isn't. :)

Hi Phillip,

I can not try, because I am working here on a Linux system (fortunately!), but your problem seems to be that you have to write your directory path like so:

SetDirectory["C:\\homework\\homework"]

A single backslash followed by a character has typically a special meaning, e.g. "\n" means 'newline'.

Regards -- Henrik

Just thought to update you if you were interested. It does import the files if I don't have the iterative scheme. I had been doing that for quite a while using the single slash anyways, but I did wanted to see if you were correct. It seems to have stirred up more problems while complaining about the same issue.

Attachments:

I can not verify your output. And it is hard to tell without having the code - instead of a picture of code. Maybe there are some hidden characters somewhere. And what happened between Out[102] and Out[105]?

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract